about summary refs log tree commit diff
path: root/pkgs/build-support/fetchnextcloudapp/default.nix
blob: 29a3f727a082475b03eaa8f567c960a96ff0f886 (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
37
38
39
40
41
42
43
{ stdenv, fetchzip, applyPatches, lib, ... }:
{ url
, sha256
, licenses
, patches ? [ ]
, name ? null
, version ? null
, description ? null
, homepage ? null
}:
let
  # TODO: do something better
  licenseMap = {
    "agpl" = lib.licenses.agpl3Only;
    "apache" = lib.licenses.asl20;
  };
in
if name != null || version != null then throw ''
  `pkgs.fetchNextcloudApp` has been changed to use `fetchzip`.
  To update, please
  * remove `name`/`version`
  * update the hash
''
else applyPatches {
  inherit patches;
  src = fetchzip {
    inherit url 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 =
    ({
      licenses = map (licenseString: licenseMap.${licenseString}) licenses;
      longDescription = description;
      inherit homepage;
    });
  };
}