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