summaryrefslogtreecommitdiffstats
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2021-03-11 12:21:28 +0000
committerGitHub <noreply@github.com>2021-03-11 12:21:28 +0000
commitb4d5951d9e9a0af775e6379f3560ed39d30b7590 (patch)
tree83a9a3f0e10f5a231385cea87048a683c22a2068 /pkgs/build-support
parent31dc9fe4576c6f9c161742d26bbf06be63d9d20b (diff)
parent0213d5f9330cdea6a02d38534b0b8d1be1ddc4ef (diff)
Merge master into staging-next
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/fetchsourcehut/default.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchsourcehut/default.nix b/pkgs/build-support/fetchsourcehut/default.nix
new file mode 100644
index 000000000000..ed2f074200cd
--- /dev/null
+++ b/pkgs/build-support/fetchsourcehut/default.nix
@@ -0,0 +1,25 @@
+{ fetchzip, lib }:
+
+{ owner
+, repo, rev
+, domain ? "sr.ht"
+, vc ? "git"
+, name ? "source"
+, ... # For hash agility
+} @ args:
+
+with lib;
+
+assert (lib.assertOneOf "vc" vc [ "hg" "git" ]);
+
+let
+ baseUrl = "https://${vc}.${domain}/${owner}/${repo}";
+
+in fetchzip (recursiveUpdate {
+ inherit name;
+ url = "${baseUrl}/archive/${rev}.tar.gz";
+ meta.homepage = "${baseUrl}/";
+ extraPostFetch = optionalString (vc == "hg") ''
+ rm -f "$out/.hg_archival.txt"
+ ''; # impure file; see #12002
+} (removeAttrs args [ "owner" "repo" "rev" "domain" "vc" ])) // { inherit rev; }