mirror of
https://github.com/NixOS/nix
synced 2025-06-29 19:03:16 +02:00
Improve error messages from call-flake.nix
This commit is contained in:
parent
28b62dd3e0
commit
a291e37b20
3 changed files with 12 additions and 8 deletions
|
@ -477,10 +477,15 @@ EvalState::EvalState(
|
||||||
throw RestrictedPathError("access to absolute path '%1%' is forbidden %2%", path, modeInformation);
|
throw RestrictedPathError("access to absolute path '%1%' is forbidden %2%", path, modeInformation);
|
||||||
}))
|
}))
|
||||||
, corepkgsFS(makeMemoryInputAccessor())
|
, corepkgsFS(makeMemoryInputAccessor())
|
||||||
|
, internalFS(makeMemoryInputAccessor())
|
||||||
, derivationInternal{corepkgsFS->addFile(
|
, derivationInternal{corepkgsFS->addFile(
|
||||||
CanonPath("derivation-internal.nix"),
|
CanonPath("derivation-internal.nix"),
|
||||||
#include "primops/derivation.nix.gen.hh"
|
#include "primops/derivation.nix.gen.hh"
|
||||||
)}
|
)}
|
||||||
|
, callFlakeInternal{internalFS->addFile(
|
||||||
|
CanonPath("call-flake.nix"),
|
||||||
|
#include "flake/call-flake.nix.gen.hh"
|
||||||
|
)}
|
||||||
, store(store)
|
, store(store)
|
||||||
, buildStore(buildStore ? buildStore : store)
|
, buildStore(buildStore ? buildStore : store)
|
||||||
, debugRepl(nullptr)
|
, debugRepl(nullptr)
|
||||||
|
@ -499,6 +504,7 @@ EvalState::EvalState(
|
||||||
, staticBaseEnv{std::make_shared<StaticEnv>(false, nullptr)}
|
, staticBaseEnv{std::make_shared<StaticEnv>(false, nullptr)}
|
||||||
{
|
{
|
||||||
corepkgsFS->setPathDisplay("<nix", ">");
|
corepkgsFS->setPathDisplay("<nix", ">");
|
||||||
|
internalFS->setPathDisplay("«nix-internal»", "");
|
||||||
|
|
||||||
countCalls = getEnv("NIX_COUNT_CALLS").value_or("0") != "0";
|
countCalls = getEnv("NIX_COUNT_CALLS").value_or("0") != "0";
|
||||||
|
|
||||||
|
|
|
@ -111,9 +111,12 @@ public:
|
||||||
|
|
||||||
const ref<FSInputAccessor> rootFS;
|
const ref<FSInputAccessor> rootFS;
|
||||||
const ref<MemoryInputAccessor> corepkgsFS;
|
const ref<MemoryInputAccessor> corepkgsFS;
|
||||||
|
const ref<MemoryInputAccessor> internalFS;
|
||||||
|
|
||||||
const SourcePath derivationInternal;
|
const SourcePath derivationInternal;
|
||||||
|
|
||||||
|
const SourcePath callFlakeInternal;
|
||||||
|
|
||||||
/* A map keyed by InputAccessor::number that keeps input accessors
|
/* A map keyed by InputAccessor::number that keeps input accessors
|
||||||
alive. */
|
alive. */
|
||||||
std::unordered_map<size_t, ref<InputAccessor>> inputAccessors;
|
std::unordered_map<size_t, ref<InputAccessor>> inputAccessors;
|
||||||
|
@ -124,7 +127,6 @@ public:
|
||||||
/* Store used to build stuff. */
|
/* Store used to build stuff. */
|
||||||
const ref<Store> buildStore;
|
const ref<Store> buildStore;
|
||||||
|
|
||||||
RootValue vCallFlake = nullptr;
|
|
||||||
RootValue vImportedDrvToDerivation = nullptr;
|
RootValue vImportedDrvToDerivation = nullptr;
|
||||||
|
|
||||||
/* Debugger */
|
/* Debugger */
|
||||||
|
|
|
@ -704,14 +704,10 @@ void callFlake(EvalState & state,
|
||||||
|
|
||||||
vRootSubdir->mkString(lockedFlake.flake.lockedRef.subdir);
|
vRootSubdir->mkString(lockedFlake.flake.lockedRef.subdir);
|
||||||
|
|
||||||
if (!state.vCallFlake) {
|
Value vCallFlake;
|
||||||
state.vCallFlake = allocRootValue(state.allocValue());
|
state.evalFile(state.callFlakeInternal, vCallFlake);
|
||||||
state.eval(state.parseExprFromString(
|
|
||||||
#include "call-flake.nix.gen.hh"
|
|
||||||
, state.rootPath("/")), **state.vCallFlake);
|
|
||||||
}
|
|
||||||
|
|
||||||
state.callFunction(**state.vCallFlake, *vLocks, *vTmp1, noPos);
|
state.callFunction(vCallFlake, *vLocks, *vTmp1, noPos);
|
||||||
state.callFunction(*vTmp1, *vRootSrc, *vTmp2, noPos);
|
state.callFunction(*vTmp1, *vRootSrc, *vTmp2, noPos);
|
||||||
state.callFunction(*vTmp2, *vRootSubdir, vRes, noPos);
|
state.callFunction(*vTmp2, *vRootSubdir, vRes, noPos);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue