tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
fetchNextcloudApp: refactor for testing
staticdev
6 months ago
49548431
e27f6eba
+31
-36
2 changed files
expand all
collapse all
unified
split
pkgs
build-support
fetchnextcloudapp
default.nix
tests.nix
+27
-32
pkgs/build-support/fetchnextcloudapp/default.nix
···
6
6
...
7
7
}:
8
8
{
9
9
+
name ?
10
10
+
if appName == null || appVersion == null then null else "nextcloud-app-${appName}-${appVersion}",
9
11
url,
10
12
hash ? "",
11
13
sha256 ? "",
···
15
17
license,
16
18
patches ? [ ],
17
19
description ? null,
20
20
+
longDescription ? description,
18
21
homepage ? null,
19
22
maintainers ? [ ],
20
23
teams ? [ ],
21
24
unpack ? false, # whether to use fetchzip rather than fetchurl
22
25
}:
23
23
-
applyPatches (
24
24
-
{
25
25
-
inherit patches;
26
26
-
src = (if unpack then fetchzip else fetchurl) {
27
27
-
inherit
28
28
-
url
29
29
-
hash
30
30
-
sha256
31
31
-
sha512
32
32
-
;
33
33
-
meta = {
34
34
-
license = lib.licenses.${license};
35
35
-
longDescription = description;
36
36
-
inherit homepage maintainers teams;
37
37
-
}
38
38
-
// lib.optionalAttrs (description != null) {
39
39
-
longDescription = description;
40
40
-
}
41
41
-
// lib.optionalAttrs (homepage != null) {
42
42
-
inherit homepage;
43
43
-
};
26
26
+
applyPatches {
27
27
+
${if name == null then null else "name"} = name;
28
28
+
inherit patches;
29
29
+
30
30
+
src = (if unpack then fetchzip else fetchurl) {
31
31
+
inherit url;
32
32
+
${if hash == "" then null else "hash"} = hash;
33
33
+
${if sha256 == "" then null else "sha256"} = sha256;
34
34
+
${if sha512 == "" then null else "sha512"} = sha512;
35
35
+
36
36
+
meta = {
37
37
+
license = lib.licenses.${license};
38
38
+
${if description == null then null else "description"} = description;
39
39
+
${if longDescription == null then null else "longDescription"} = longDescription;
40
40
+
${if homepage == null then null else "homepage"} = homepage;
41
41
+
inherit maintainers teams;
44
42
};
45
45
-
prePatch = ''
46
46
-
if [ ! -f ./appinfo/info.xml ]; then
47
47
-
echo "appinfo/info.xml doesn't exist in $out, aborting!"
48
48
-
exit 1
49
49
-
fi
50
50
-
'';
51
51
-
}
52
52
-
// lib.optionalAttrs (appName != null && appVersion != null) {
53
53
-
name = "nextcloud-app-${appName}-${appVersion}";
54
54
-
}
55
55
-
)
43
43
+
};
44
44
+
prePatch = ''
45
45
+
if [ ! -f ./appinfo/info.xml ]; then
46
46
+
echo "appinfo/info.xml doesn't exist in $out, aborting!"
47
47
+
exit 1
48
48
+
fi
49
49
+
'';
50
50
+
}
+4
-4
pkgs/build-support/fetchnextcloudapp/tests.nix
···
5
5
}:
6
6
7
7
{
8
8
-
simple-sha512 = testers.invalidateFetcherByDrvHash (fetchNextcloudApp {
8
8
+
simple-sha512 = testers.invalidateFetcherByDrvHash fetchNextcloudApp {
9
9
appName = "phonetrack";
10
10
appVersion = "0.8.2";
11
11
license = "agpl3Plus";
12
12
sha512 = "f67902d1b48def9a244383a39d7bec95bb4215054963a9751f99dae9bd2f2740c02d2ef97b3b76d69a36fa95f8a9374dd049440b195f4dad2f0c4bca645de228";
13
13
url = "https://github.com/julien-nc/phonetrack/releases/download/v0.8.2/phonetrack-0.8.2.tar.gz";
14
14
-
});
15
15
-
simple-sha256 = testers.invalidateFetcherByDrvHash (fetchNextcloudApp {
14
14
+
};
15
15
+
simple-sha256 = testers.invalidateFetcherByDrvHash fetchNextcloudApp {
16
16
appName = "phonetrack";
17
17
appVersion = "0.8.2";
18
18
license = "agpl3Plus";
19
19
sha256 = "7c4252186e0ff8e0b97fc3d30131eeadd51bd2f9cc6aa321eb0c1c541f9572c0";
20
20
url = "https://github.com/julien-nc/phonetrack/releases/download/v0.8.2/phonetrack-0.8.2.tar.gz";
21
21
-
});
21
21
+
};
22
22
}