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

Merge pull request #12730 from xokdvium/repl-shell-env

libcmd/repl: Fix missing runNix in repl
This commit is contained in:
John Ericson 2025-03-23 23:53:26 -04:00 committed by GitHub
commit ff17dd2a9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View file

@ -124,7 +124,7 @@ std::string removeWhitespace(std::string s)
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)
, debugTraceIndex(0)
, getValues(getValues)
@ -839,9 +839,10 @@ std::unique_ptr<AbstractNixRepl> AbstractNixRepl::create(
{
return std::make_unique<NixRepl>(
lookupPath,
openStore(),
std::move(store),
state,
getValues
getValues,
runNix
);
}
@ -859,7 +860,8 @@ ReplExitStatus AbstractNixRepl::runSimple(
lookupPath,
openStore(),
evalState,
getValues
getValues,
/*runNix=*/nullptr
);
repl->initEnv();

View file

@ -56,6 +56,10 @@ testRepl () {
nix repl "${nixArgs[@]}" 2>&1 <<< "builtins.currentSystem" \
| grep "$(nix-instantiate --eval -E 'builtins.currentSystem')"
# regression test for #12163
replOutput=$(nix repl "${nixArgs[@]}" 2>&1 <<< ":sh import $testDir/simple.nix")
echo "$replOutput" | grepInverse "error: Cannot run 'nix-shell'"
expectStderr 1 nix repl "${testDir}/simple.nix" \
| grepQuiet -s "error: path '$testDir/simple.nix' is not a flake"
}