1{
2 fetchurl,
3 fetchzip,
4 applyPatches,
5 lib,
6 ...
7}:
8{
9 name ?
10 if appName == null || appVersion == null then null else "nextcloud-app-${appName}-${appVersion}",
11 url,
12 hash ? "",
13 sha256 ? "",
14 sha512 ? "",
15 appName ? null,
16 appVersion ? null,
17 license,
18 patches ? [ ],
19 description ? null,
20 longDescription ? description,
21 homepage ? null,
22 maintainers ? [ ],
23 teams ? [ ],
24 unpack ? false, # whether to use fetchzip rather than fetchurl
25}:
26applyPatches {
27 ${if name == null then null else "name"} = name;
28 inherit patches;
29
30 src = (if unpack then fetchzip else fetchurl) {
31 inherit url;
32 ${if hash == "" then null else "hash"} = hash;
33 ${if sha256 == "" then null else "sha256"} = sha256;
34 ${if sha512 == "" then null else "sha512"} = sha512;
35
36 meta = {
37 license = lib.licenses.${license};
38 ${if description == null then null else "description"} = description;
39 ${if longDescription == null then null else "longDescription"} = longDescription;
40 ${if homepage == null then null else "homepage"} = homepage;
41 inherit maintainers teams;
42 };
43 };
44 prePatch = ''
45 if [ ! -f ./appinfo/info.xml ]; then
46 echo "appinfo/info.xml doesn't exist in $out, aborting!"
47 exit 1
48 fi
49 '';
50}