fetchFromSourcehut: init

This commit is contained in:
luc65r
2020-10-31 11:28:06 +01:00
committed by Lucas Ransan
parent 8aca4a8fa7
commit 83a0627f33
3 changed files with 31 additions and 0 deletions

View File

@@ -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; }