Skip to content

Commit 43d6671

Browse files
authored
fetchNextcloudApp: add sha512 (#435930)
2 parents ebbc7fb + 4954843 commit 43d6671

File tree

4 files changed

+57
-30
lines changed

4 files changed

+57
-30
lines changed

nixos/modules/services/web-apps/nextcloud.nix

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,10 @@ in
391391
inherit (pkgs.nextcloud31Packages.apps) mail calendar contacts;
392392
phonetrack = pkgs.fetchNextcloudApp {
393393
name = "phonetrack";
394-
sha256 = "0qf366vbahyl27p9mshfma1as4nvql6w75zy2zk5xwwbp343vsbc";
395-
url = "https://gitlab.com/eneiluj/phonetrack-oc/-/wikis/uploads/931aaaf8dca24bf31a7e169a83c17235/phonetrack-0.6.9.tar.gz";
396-
version = "0.6.9";
394+
license = "agpl3Plus";
395+
sha512 = "f67902d1b48def9a244383a39d7bec95bb4215054963a9751f99dae9bd2f2740c02d2ef97b3b76d69a36fa95f8a9374dd049440b195f4dad2f0c4bca645de228";
396+
url = "https://github.com/julien-nc/phonetrack/releases/download/v0.8.2/phonetrack-0.8.2.tar.gz";
397+
version = "0.8.2";
397398
};
398399
}
399400
'';

pkgs/build-support/fetchnextcloudapp/default.nix

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,45 @@
66
...
77
}:
88
{
9+
name ?
10+
if appName == null || appVersion == null then null else "nextcloud-app-${appName}-${appVersion}",
911
url,
1012
hash ? "",
1113
sha256 ? "",
14+
sha512 ? "",
1215
appName ? null,
1316
appVersion ? null,
1417
license,
1518
patches ? [ ],
1619
description ? null,
20+
longDescription ? description,
1721
homepage ? null,
1822
maintainers ? [ ],
1923
teams ? [ ],
2024
unpack ? false, # whether to use fetchzip rather than fetchurl
2125
}:
22-
applyPatches (
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-
};
26+
applyPatches {
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;
3842
};
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-
)
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+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
testers,
3+
fetchNextcloudApp,
4+
...
5+
}:
6+
7+
{
8+
simple-sha512 = testers.invalidateFetcherByDrvHash fetchNextcloudApp {
9+
appName = "phonetrack";
10+
appVersion = "0.8.2";
11+
license = "agpl3Plus";
12+
sha512 = "f67902d1b48def9a244383a39d7bec95bb4215054963a9751f99dae9bd2f2740c02d2ef97b3b76d69a36fa95f8a9374dd049440b195f4dad2f0c4bca645de228";
13+
url = "https://github.com/julien-nc/phonetrack/releases/download/v0.8.2/phonetrack-0.8.2.tar.gz";
14+
};
15+
simple-sha256 = testers.invalidateFetcherByDrvHash fetchNextcloudApp {
16+
appName = "phonetrack";
17+
appVersion = "0.8.2";
18+
license = "agpl3Plus";
19+
sha256 = "7c4252186e0ff8e0b97fc3d30131eeadd51bd2f9cc6aa321eb0c1c541f9572c0";
20+
url = "https://github.com/julien-nc/phonetrack/releases/download/v0.8.2/phonetrack-0.8.2.tar.gz";
21+
};
22+
}

pkgs/test/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ with pkgs;
131131
fetchDebianPatch = recurseIntoAttrs (callPackages ../build-support/fetchdebianpatch/tests.nix { });
132132
fetchzip = recurseIntoAttrs (callPackages ../build-support/fetchzip/tests.nix { });
133133
fetchgit = recurseIntoAttrs (callPackages ../build-support/fetchgit/tests.nix { });
134+
fetchNextcloudApp = recurseIntoAttrs (
135+
callPackages ../build-support/fetchnextcloudapp/tests.nix { }
136+
);
134137
fetchFromBitbucket = recurseIntoAttrs (callPackages ../build-support/fetchbitbucket/tests.nix { });
135138
fetchFirefoxAddon = recurseIntoAttrs (
136139
callPackages ../build-support/fetchfirefoxaddon/tests.nix { }

0 commit comments

Comments
 (0)