1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-04 19:45:54 +00:00
nixpkgs/pkgs/build-support/fetchgitlab/default.nix
2019-12-09 01:33:16 +00:00

22 lines
573 B
Nix

{ fetchzip, lib }:
# gitlab example
{ owner, repo, rev, domain ? "gitlab.com", name ? "source", group ? null
, ... # For hash agility
} @ 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/${escapedSlug}/repository/archive.tar.gz?sha=${rev}";
meta.homepage = "https://${domain}/${slug}/";
} // removeAttrs args [ "domain" "owner" "group" "repo" "rev" ]) // { inherit rev; }