diff options
author | Michael Weiss <dev.primeos@gmail.com> | 2021-03-11 12:51:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-11 12:51:13 +0100 |
commit | 938453eacdb82331a2567bb584a7c7786161f20b (patch) | |
tree | 7d6287536b4313b9094048d4e0aad3102faadc2a /pkgs/build-support | |
parent | 5c529751e718ad4bc14e1fcb7b7baff09e8fb8c3 (diff) | |
parent | 2b9f10dbe99cc9cd9af336dccf2afb63e19cddd0 (diff) |
Merge pull request #102225 from luc65r/fetchsrht
Add fetcher: fetchFromSourcehut
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/fetchsourcehut/default.nix | 25 |
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; } |