1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-03 10:21:47 +02:00

libcmd/repl: Fix missing runNix in repl

Without this :u, :sh and :i repl commands fail with:

> Cannot run 'nix-shell'/`nix-env` because no method of calling the Nix
> CLI was provided. This is a configuration problem pertaining to how
> this program was built.

Remove the default ctor argument as it evidently makes catching
refactoring bugs much harder. `NixRepl` implementation lives completely
in `repl.cc`, so we can be as explicit as necessary.
This commit is contained in:
Sergei Zimmerman 2025-03-23 22:13:14 +00:00
parent 8066e4b0c3
commit 44055dc09d
No known key found for this signature in database
GPG key ID: A9B0B557CA632325

View file

@ -124,7 +124,7 @@ std::string removeWhitespace(std::string s)
NixRepl::NixRepl(const LookupPath & lookupPath, nix::ref<Store> store, ref<EvalState> state, NixRepl::NixRepl(const LookupPath & lookupPath, nix::ref<Store> store, ref<EvalState> state,
std::function<NixRepl::AnnotatedValues()> getValues, RunNix * runNix = nullptr) std::function<NixRepl::AnnotatedValues()> getValues, RunNix * runNix)
: AbstractNixRepl(state) : AbstractNixRepl(state)
, debugTraceIndex(0) , debugTraceIndex(0)
, getValues(getValues) , getValues(getValues)
@ -841,7 +841,8 @@ std::unique_ptr<AbstractNixRepl> AbstractNixRepl::create(
lookupPath, lookupPath,
std::move(store), std::move(store),
state, state,
getValues getValues,
runNix
); );
} }
@ -859,7 +860,8 @@ ReplExitStatus AbstractNixRepl::runSimple(
lookupPath, lookupPath,
openStore(), openStore(),
evalState, evalState,
getValues getValues,
/*runNix=*/nullptr
); );
repl->initEnv(); repl->initEnv();