2019-01-26 15:06:25 +00:00
|
|
|
{ fetchzip, lib }:
|
|
|
|
|
|
|
|
# gitlab example
|
|
|
|
{ owner, repo, rev, domain ? "gitlab.com", name ? "source", group ? null
|
|
|
|
, ... # For hash agility
|
2019-11-24 19:54:46 +00:00
|
|
|
} @ args:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
slug = concatStringsSep "/"
|
|
|
|
((optional (group != null) group) ++ [ owner repo ]);
|
|
|
|
|
|
|
|
escapedSlug = replaceStrings ["." "/"] ["%2E" "%2F"] slug;
|
2020-05-24 20:40:41 +01:00
|
|
|
escapedRev = replaceStrings ["+"] ["%2B"] rev;
|
2019-11-24 19:54:46 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
fetchzip ({
|
2019-01-26 15:06:25 +00:00
|
|
|
inherit name;
|
2020-05-24 20:40:41 +01:00
|
|
|
url = "https://${domain}/api/v4/projects/${escapedSlug}/repository/archive.tar.gz?sha=${escapedRev}";
|
2019-11-24 19:54:46 +00:00
|
|
|
meta.homepage = "https://${domain}/${slug}/";
|
2019-01-26 15:06:25 +00:00
|
|
|
} // removeAttrs args [ "domain" "owner" "group" "repo" "rev" ]) // { inherit rev; }
|