1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

getFlake: In pure mode, check that the argument is an immutable flakeref

This commit is contained in:
Eelco Dolstra 2020-04-03 13:07:05 +02:00
parent bb39f2bb8a
commit 9c78f7f196
2 changed files with 13 additions and 1 deletions

View file

@ -628,8 +628,13 @@ void callFlake(EvalState & state,
static void prim_getFlake(EvalState & state, const Pos & pos, Value * * args, Value & v)
{
auto flakeRefS = state.forceStringNoCtx(*args[0], pos);
auto flakeRef = parseFlakeRef(flakeRefS);
if (evalSettings.pureEval && !flakeRef.input->isImmutable())
throw Error("cannot call 'getFlake' on mutable flake reference '%s', at %s (use --impure to override)", flakeRefS, pos);
callFlake(state,
lockFlake(state, parseFlakeRef(state.forceStringNoCtx(*args[0], pos)),
lockFlake(state, flakeRef,
LockFlags {
.updateLockFile = false,
.useRegistries = !evalSettings.pureEval,