mirror of
https://github.com/NixOS/nix
synced 2025-07-05 20:41:47 +02:00
builtin:fetchurl: Ensure a fixed-output derivation
Previously we didn't check that the derivation was fixed-output, so you could use builtin:fetchurl to impurely fetch a file.
This commit is contained in:
parent
ef6d055ace
commit
1ee42c5b88
2 changed files with 6 additions and 0 deletions
|
@ -16,6 +16,9 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData)
|
|||
writeFile(settings.netrcFile, netrcData, 0600);
|
||||
}
|
||||
|
||||
if (!drv.type().isFixed())
|
||||
throw Error("'builtin:fetchurl' must be a fixed-output derivation");
|
||||
|
||||
auto getAttr = [&](const std::string & name) {
|
||||
auto i = drv.env.find(name);
|
||||
if (i == drv.env.end()) throw Error("attribute '%s' missing", name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue