git.iko.soy/typeable/nixpkgs
on master help sign in
fetchFromGitLab: improve readability
commitee49b45a7b091287d44966b00d2a4f07d3fcbdfc authorAlyssa Ross <hi@alyssa.is> dateSun 24 Nov 2019, 19:54 (7 years ago) parent571c310
1 file changed+14−3
pkgs/build-support/fetchgitlab/default.nix+14−3
pkgs/build-support/fetchgitlab/default.nix+14−3
@@ -3,8 +3,19 @@
33# gitlab example
44{ owner, repo, rev, domain ? "gitlab.com", name ? "source", group ? null
55, ... # For hash agility
6−}@args: fetchzip ({
6+} @ args:
7+
8+with lib;
9+
10+let
11+ slug = concatStringsSep "/"
12+ ((optional (group != null) group) ++ [ owner repo ]);
13+
14+ escapedSlug = replaceStrings ["." "/"] ["%2E" "%2F"] slug;
15+in
16+
17+fetchzip ({
718 inherit name;
8− 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}";
9− meta.homepage = "https://${domain}/${lib.optionalString (group != null) "${group}/"}${owner}/${repo}/";
19+ url = "https://${domain}/api/v4/projects/${escapedSlug}/repository/archive.tar.gz?sha=${rev}";
20+ meta.homepage = "https://${domain}/${slug}/";
1021} // removeAttrs args [ "domain" "owner" "group" "repo" "rev" ]) // { inherit rev; }