all-packages: move fetch* to pkgs/build-support/

This commit is contained in:
Matthew Bauer
2019-01-26 10:06:25 -05:00
parent cb14f1404a
commit d16e0f8dc3
6 changed files with 78 additions and 68 deletions

View File

@@ -0,0 +1,10 @@
{ fetchzip, lib }:
# gitlab example
{ owner, repo, rev, domain ? "gitlab.com", name ? "source", group ? null
, ... # For hash agility
}@args: fetchzip ({
inherit name;
url = "https://${domain}/api/v4/projects/${lib.optionalString (group != null) "${lib.replaceStrings ["."] ["%2E"] group}%2F"}${lib.replaceStrings ["."] ["%2E"] owner}%2F${lib.replaceStrings ["."] ["%2E"] repo}/repository/archive.tar.gz?sha=${rev}";
meta.homepage = "https://${domain}/${lib.optionalString (group != null) "${group}/"}${owner}/${repo}/";
} // removeAttrs args [ "domain" "owner" "group" "repo" "rev" ]) // { inherit rev; }