Allow derivations-as-srcs in the context of builtins.toFile files

This commit is contained in:
Shea Levy 2015-07-23 09:34:06 -04:00 committed by Eelco Dolstra
parent 61af14a921
commit 1ed55234d9

View file

@ -872,8 +872,12 @@ static void prim_toFile(EvalState & state, const Pos & pos, Value * * args, Valu
for (auto path : context) { for (auto path : context) {
if (path.at(0) == '=') path = string(path, 1); if (path.at(0) == '=') path = string(path, 1);
if (isDerivation(path)) if (isDerivation(path)) {
throw EvalError(format("in toFile: the file %1% cannot refer to derivation outputs, at %2%") % name % pos); /* See prim_unsafeDiscardOutputDependency. */
if (path.at(0) != '~')
throw EvalError(format("in toFile: the file %1% cannot refer to derivation outputs, at %2%") % name % pos);
path = string(path, 1);
}
refs.insert(path); refs.insert(path);
} }