about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/fetchnextcloudapp/default.nix
blob: 059003df903d4d46036f6f02956fd12fd1e8f625 (plain) (blame)
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
{ stdenv, fetchzip, applyPatches, lib, ... }:
{ url
, hash ? ""
, sha256 ? ""
, appName ? null
, appVersion ? null
, license
, patches ? [ ]
, description ? null
, homepage ? null
}:
applyPatches ({
  inherit patches;
  src = fetchzip {
    inherit url hash sha256;
    postFetch = ''
      pushd $out &>/dev/null
      if [ ! -f ./appinfo/info.xml ]; then
        echo "appinfo/info.xml doesn't exist in $out, aborting!"
        exit 1
      fi
      popd &>/dev/null
    '';
    meta = {
      license = lib.licenses.${license};
      longDescription = description;
      inherit homepage;
    } // lib.optionalAttrs (description != null) {
      longDescription = description;
    } // lib.optionalAttrs (homepage != null) {
      inherit homepage;
    };
  };
} // lib.optionalAttrs (appName != null && appVersion != null) {
  name = "nextcloud-app-${appName}-${appVersion}";
})