forked from lix-project/lix
Merge pull request #5020 from NixOS/make-the-repl-reuse-the-whole-nix-config
Forward the whole Nix config to the repl subprocesses
This commit is contained in:
commit
58cb411db6
3 changed files with 20 additions and 4 deletions
|
@ -107,11 +107,8 @@ NixRepl::~NixRepl()
|
||||||
string runNix(Path program, const Strings & args,
|
string runNix(Path program, const Strings & args,
|
||||||
const std::optional<std::string> & input = {})
|
const std::optional<std::string> & input = {})
|
||||||
{
|
{
|
||||||
auto experimentalFeatures = concatStringsSep(" ", settings.experimentalFeatures.get());
|
|
||||||
auto nixConf = getEnv("NIX_CONFIG").value_or("");
|
|
||||||
nixConf.append("\nexperimental-features = " + experimentalFeatures);
|
|
||||||
auto subprocessEnv = getEnv();
|
auto subprocessEnv = getEnv();
|
||||||
subprocessEnv["NIX_CONFIG"] = nixConf;
|
subprocessEnv["NIX_CONFIG"] = globalConfig.toKeyValue();
|
||||||
RunOptions opts(settings.nixBinDir+ "/" + program, args);
|
RunOptions opts(settings.nixBinDir+ "/" + program, args);
|
||||||
opts.input = input;
|
opts.input = input;
|
||||||
opts.environment = subprocessEnv;
|
opts.environment = subprocessEnv;
|
||||||
|
|
|
@ -46,6 +46,7 @@ nix_tests = \
|
||||||
flakes.sh \
|
flakes.sh \
|
||||||
build.sh \
|
build.sh \
|
||||||
compute-levels.sh \
|
compute-levels.sh \
|
||||||
|
repl.sh \
|
||||||
ca/build.sh \
|
ca/build.sh \
|
||||||
ca/build-with-garbage-path.sh \
|
ca/build-with-garbage-path.sh \
|
||||||
ca/duplicate-realisation-in-closure.sh \
|
ca/duplicate-realisation-in-closure.sh \
|
||||||
|
|
18
tests/repl.sh
Normal file
18
tests/repl.sh
Normal 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"
|
Loading…
Reference in a new issue