Be more consistent with Nix itself when fetching github/gitlab inputs

* `url` got renamed to `host` in Nix[1], so we have to use this key here
  as well.
* It was suggested previously[2] to use the same URL to download from a
  GitLab-server as Nix does.

[1] 56f1e0df05
[2] 0e29814f1e (commitcomment-42619895)
This commit is contained in:
Maximilian Bosch 2020-09-22 21:13:43 +02:00
parent 2f9a141d4b
commit 0d4ab83c96
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E

View file

@ -16,7 +16,7 @@ let
fetchTree = fetchTree =
info: info:
if info.type == "github" then if info.type == "github" then
{ outPath = fetchTarball "https://api.${info.url or "github.com"}/repos/${info.owner}/${info.repo}/tarball/${info.rev}"; { outPath = fetchTarball "https://api.${info.host or "github.com"}/repos/${info.owner}/${info.repo}/tarball/${info.rev}";
rev = info.rev; rev = info.rev;
shortRev = builtins.substring 0 7 info.rev; shortRev = builtins.substring 0 7 info.rev;
lastModified = info.lastModified; lastModified = info.lastModified;
@ -46,7 +46,7 @@ let
} }
else if info.type == "gitlab" then else if info.type == "gitlab" then
{ inherit (info) rev narHash lastModified; { inherit (info) rev narHash lastModified;
outPath = fetchTarball "https://${info.url or "gitlab.com"}/${info.owner}/${info.repo}/-/archive/${info.rev}/${info.repo}-${info.rev}.tar.gz"; outPath = fetchTarball "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}";
shortRev = builtins.substring 0 7 info.rev; shortRev = builtins.substring 0 7 info.rev;
} }
else else