fetchFromGitLab: improve readability
This commit is contained in:
parent
571c310007
commit
ee49b45a7b
@ -3,8 +3,19 @@
|
|||||||
# gitlab example
|
# gitlab example
|
||||||
{ owner, repo, rev, domain ? "gitlab.com", name ? "source", group ? null
|
{ owner, repo, rev, domain ? "gitlab.com", name ? "source", group ? null
|
||||||
, ... # For hash agility
|
, ... # 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;
|
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}";
|
url = "https://${domain}/api/v4/projects/${escapedSlug}/repository/archive.tar.gz?sha=${rev}";
|
||||||
meta.homepage = "https://${domain}/${lib.optionalString (group != null) "${group}/"}${owner}/${repo}/";
|
meta.homepage = "https://${domain}/${slug}/";
|
||||||
} // removeAttrs args [ "domain" "owner" "group" "repo" "rev" ]) // { inherit rev; }
|
} // removeAttrs args [ "domain" "owner" "group" "repo" "rev" ]) // { inherit rev; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user