summaryrefslogtreecommitdiff
path: root/pkgs/build-support/fetchnextcloudapp/default.nix
blob: f24b4e44c07f20e766c3a80c3539cb9d89bea0c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
  fetchurl,
  fetchzip,
  applyPatches,
  lib,
  ...
}:
{
  name ?
    if appName == null || appVersion == null then null else "nextcloud-app-${appName}-${appVersion}",
  url,
  hash ? "",
  sha256 ? "",
  sha512 ? "",
  appName ? null,
  appVersion ? null,
  license,
  patches ? [ ],
  description ? null,
  longDescription ? description,
  homepage ? null,
  maintainers ? [ ],
  teams ? [ ],
  unpack ? false, # whether to use fetchzip rather than fetchurl
}:
applyPatches {
  ${if name == null then null else "name"} = name;
  inherit patches;

  src = (if unpack then fetchzip else fetchurl) {
    inherit url;
    ${if hash == "" then null else "hash"} = hash;
    ${if sha256 == "" then null else "sha256"} = sha256;
    ${if sha512 == "" then null else "sha512"} = sha512;

    meta = {
      license = lib.licenses.${license};
      ${if description == null then null else "description"} = description;
      ${if longDescription == null then null else "longDescription"} = longDescription;
      ${if homepage == null then null else "homepage"} = homepage;
      inherit maintainers teams;
      sourceProvenance = with lib.sourceTypes; [
        fromSource
        binaryBytecode # vendored deps, compiled vue templates, etc
      ];
    };
  };
  prePatch = ''
    if [ ! -f ./appinfo/info.xml ]; then
      echo "appinfo/info.xml doesn't exist in $out, aborting!"
      exit 1
    fi
  '';
}