Use narHash for fetchTarball

Otherwise, sha256 is a flat hash instead of a recursive hash in Nix 2.7.0
This commit is contained in:
Matthew Bauer 2022-08-24 13:23:49 -05:00
parent b4a34015c6
commit 4d49c8c97e

View file

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