From f7c5cf6c62aa06283a053b0c3ab3bd57d6b9aedb Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Mon, 28 Apr 2025 18:59:09 +0200 Subject: [PATCH] repl: only send overridden settings to nix subprocesses The nix-shell and nix-env subprocess spawned by :sh and :i respectively should use the same settings as the nix repl they were launched from. Previously, this was accomplished by sending them the entire configuration explicitly, causing warnings like the following: warning: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled In addition, if connected to the daemon, all other settings would be forwarded to the daemon, further causing large quantities of warnings like the following if the user is not trusted: warning: Ignoring the client-specified setting 'allow-symlinked-store', because it is a restricted setting and you are not a trusted user Similarly to ece99fee23d53185436a91f4cdd5cf5ad9652384 (for the build hook) and 523965697d9a16f0dd89f0d5b795b44ce5d6f712 (for the post-build-hook), we will now only send overridden settings to the subprocess. The resulting configuration is the same, and all warnings are avoided because the client was already smart enough to not send unchanged defaults to the daemon. Fixes: https://git.lix.systems/lix-project/lix/issues/811 Change-Id: Icbe923cbe166aa3f462916f2b164285882564abd --- lix/libcmd/repl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lix/libcmd/repl.cc b/lix/libcmd/repl.cc index 880fb419e..fb354474b 100644 --- a/lix/libcmd/repl.cc +++ b/lix/libcmd/repl.cc @@ -243,7 +243,7 @@ NixRepl::NixRepl(const SearchPath & searchPath, nix::ref store, EvalState void runNix(Path program, const Strings & args) { auto subprocessEnv = getEnv(); - subprocessEnv["NIX_CONFIG"] = globalConfig.toKeyValue(); + subprocessEnv["NIX_CONFIG"] = globalConfig.toKeyValue(true); runProgram2(RunOptions { .program = settings.nixBinDir+ "/" + program,