libexpr: Migrate callFlake to return a Value

Change-Id: Ibdac6eb1c9dfda894d783a7b6e333f486a6a6964
This commit is contained in:
skye
2026-03-01 01:01:47 -05:00
parent 2be998eeb4
commit 8623dade34
5 changed files with 16 additions and 21 deletions
+1 -2
View File
@@ -409,8 +409,7 @@ ref<eval_cache::EvalCache> openEvalCache(
if (getEnv("NIX_ALLOW_EVAL").value_or("1") == "0")
throw Error("not everything is cached, but evaluation is not allowed");
Value vFlake;
flake::callFlake(state, *lockedFlake, vFlake);
Value vFlake = flake::callFlake(state, *lockedFlake);
state.forceAttrs(vFlake, noPos, "while parsing cached flake data");
+2 -3
View File
@@ -1318,7 +1318,7 @@ void NixRepl::loadFlake(const std::string & flakeRefS)
try {
loaded.remove(loadable);
loaded.push_back(loadable);
flake::callFlake(
v = flake::callFlake(
state,
flake::lockFlake(
state,
@@ -1328,8 +1328,7 @@ void NixRepl::loadFlake(const std::string & flakeRefS)
.useRegistries = !evalSettings.pureEval,
.allowUnlocked = !evalSettings.pureEval,
}
),
v
)
);
addAttrsToScope(v);
} catch (...) {
+11 -9
View File
@@ -940,9 +940,7 @@ LockedFlake lockFlake(
}
}
void callFlake(EvalState & state,
const LockedFlake & lockedFlake,
Value & vRes)
Value callFlake(EvalState & state, const LockedFlake & lockedFlake)
{
Value vLocks;
Value vRootSrc;
@@ -971,7 +969,7 @@ void callFlake(EvalState & state,
Value vTmp1 = state.callFunction(*state.ctx.caches.vCallFlake, vLocks, noPos);
Value vTmp2 = state.callFunction(vTmp1, vRootSrc, noPos);
vRes = state.callFunction(vTmp2, vRootSubdir, noPos);
return state.callFunction(vTmp2, vRootSubdir, noPos);
}
void prim_getFlake(EvalState & state, Value * * args, Value & v)
@@ -981,15 +979,19 @@ void prim_getFlake(EvalState & state, Value * * args, Value & v)
if (evalSettings.pureEval && !flakeRef.input.isLocked())
throw Error("cannot call 'getFlake' on unlocked flake reference '%s' (use --impure to override)", flakeRefS);
callFlake(state,
lockFlake(state, flakeRef,
LockFlags {
v = callFlake(
state,
lockFlake(
state,
flakeRef,
LockFlags{
.updateLockFile = false,
.writeLockFile = false,
.useRegistries = !evalSettings.pureEval && fetchSettings.useRegistries,
.allowUnlocked = !evalSettings.pureEval,
}),
v);
}
)
);
}
void prim_parseFlakeRef(
+1 -5
View File
@@ -199,11 +199,7 @@ LockedFlake lockFlake(
const FlakeRef & flakeRef,
const LockFlags & lockFlags);
void callFlake(
EvalState & state,
const LockedFlake & lockedFlake,
Value & v);
Value callFlake(EvalState & state, const LockedFlake & lockedFlake);
}
void emitTreeAttrs(
+1 -2
View File
@@ -596,8 +596,7 @@ struct CmdFlakeCheck : FlakeCommand
{
auto act = logger->startActivity(lvlInfo, actUnknown, "evaluating flake");
Value vFlake;
flake::callFlake(*state, flake, vFlake);
Value vFlake = flake::callFlake(*state, flake);
enumerateOutputs(
*state,