1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 06:01:48 +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

@ -107,11 +107,8 @@ NixRepl::~NixRepl()
string runNix(Path program, const Strings & args,
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();
subprocessEnv["NIX_CONFIG"] = nixConf;
subprocessEnv["NIX_CONFIG"] = globalConfig.toKeyValue();
RunOptions opts(settings.nixBinDir+ "/" + program, args);
opts.input = input;
opts.environment = subprocessEnv;