1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-20 17:29:36 +01:00

Respect the narHash attribute in more input types

(cherry picked from commit a6ff66b658)
This commit is contained in:
Eelco Dolstra 2020-04-02 19:04:33 +02:00
parent 670feb000a
commit f58a9b0e62
5 changed files with 8 additions and 8 deletions

View file

@ -205,9 +205,7 @@ struct TarballInput : Input
{
Attrs attrs;
attrs.emplace("url", url.to_string());
if (narHash)
attrs.emplace("narHash", narHash->to_string(SRI));
else if (hash)
if (hash)
attrs.emplace("hash", hash->to_string(SRI));
return attrs;
}
@ -260,7 +258,7 @@ struct TarballInputScheme : InputScheme
if (maybeGetStrAttr(attrs, "type") != "tarball") return {};
for (auto & [name, value] : attrs)
if (name != "type" && name != "url" && name != "hash" && name != "narHash")
if (name != "type" && name != "url" && name != "hash")
throw Error("unsupported tarball input attribute '%s'", name);
auto input = std::make_unique<TarballInput>(parseURL(getStrAttr(attrs, "url")));