mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
fetchFromGitLab: improve readability
This commit is contained in:
parent
571c310007
commit
ee49b45a7b
@ -3,8 +3,19 @@
|
||||
# gitlab example
|
||||
{ owner, repo, rev, domain ? "gitlab.com", name ? "source", group ? null
|
||||
, ... # For hash agility
|
||||
}@args: fetchzip ({
|
||||
} @ args:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
slug = concatStringsSep "/"
|
||||
((optional (group != null) group) ++ [ owner repo ]);
|
||||
|
||||
escapedSlug = replaceStrings ["." "/"] ["%2E" "%2F"] slug;
|
||||
in
|
||||
|
||||
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}/";
|
||||
url = "https://${domain}/api/v4/projects/${escapedSlug}/repository/archive.tar.gz?sha=${rev}";
|
||||
meta.homepage = "https://${domain}/${slug}/";
|
||||
} // removeAttrs args [ "domain" "owner" "group" "repo" "rev" ]) // { inherit rev; }
|
||||
|
Loading…
Reference in New Issue
Block a user