1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 19:23:54 +02:00

Forward the whole Nix config to the repl subprocesses

Fill `NIX_CONFIG` with the value of the current Nix configuration before
calling the nix subprocesses in the repl
That way the whole configuration (including the possible
`experimental-features`, a possibly `--store` option or whatever) will
be made available.

This is required for example to make `nix repl` work with a custom
`--store`
This commit is contained in:
regnat 2021-07-15 18:17:18 +02:00
parent db4d4cf4ba
commit c05bdef020
3 changed files with 20 additions and 4 deletions

View file

@ -46,6 +46,7 @@ nix_tests = \
flakes.sh \
build.sh \
compute-levels.sh \
repl.sh \
ca/build.sh \
ca/build-with-garbage-path.sh \
ca/duplicate-realisation-in-closure.sh \

18
tests/repl.sh Normal file
View file

@ -0,0 +1,18 @@
source common.sh
replCmds="
simple = import ./simple.nix
:b simple
"
testRepl () {
local nixArgs=("$@")
local outPath=$(nix repl "${nixArgs[@]}" <<< "$replCmds" |&
grep -o -E "$NIX_STORE_DIR/\w*-simple")
nix path-info "${nixArgs[@]}" "$outPath"
}
# Simple test, try building a drv
testRepl
# Same thing (kind-of), but with a remote store.
testRepl --store "$TEST_ROOT/store?real=$NIX_STORE_DIR"