From 1e8f7c7c7699c5f3de8241e59554f6d7fd5b1874 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 6 Dec 2025 19:44:28 +0100 Subject: [PATCH] nix/daemon: remove settings copy from parent the parent daemon does not change any settings before starting a child, so there's nothing we may want to change that is not already set by the config file. this also doesn't prevent changes of the config file being applied to daemons where we do not expect it since it'll only restore a setting to the parents' value if the child also has an override for it. Change-Id: Ic5a9ef13458c103ec9979cb187ba8d3ce5e1e719 --- lix/nix/daemon.cc | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/lix/nix/daemon.cc b/lix/nix/daemon.cc index 82d120c99..326cc90f9 100644 --- a/lix/nix/daemon.cc +++ b/lix/nix/daemon.cc @@ -55,7 +55,6 @@ #endif static constexpr int SUBDAEMON_CONNECTION_FD = 0; -static constexpr int SUBDAEMON_SETTINGS_FD = 3; namespace nix { @@ -346,9 +345,6 @@ try { peer.pidKnown ? fmt("pid %1%", peer.pid) : "unknown peer" ); - Pipe settings; - settings.create(); - // Fork a child to handle the connection. make sure it's called with // argv0 `nix-daemon` so we don't try to run `nix --for` when called // from more modern scripts that assume nix-command being available. @@ -363,11 +359,7 @@ try { fmt("%1%", int(verbosity)), }, .dieWithParent = false, - .redirections = - { - {.dup = SUBDAEMON_CONNECTION_FD, .from = remote.get()}, - {.dup = SUBDAEMON_SETTINGS_FD, .from = settings.readSide.get()}, - } + .redirections = {{.dup = SUBDAEMON_CONNECTION_FD, .from = remote.get()}} }; if (forceTrustClientOpt) { options.args.push_back( @@ -375,15 +367,6 @@ try { ); } runProgram2(options).release(); - - FdSink sink(settings.writeSide.get()); - std::map overriddenSettings; - globalConfig.getSettings(overriddenSettings, true); - for (auto & setting : overriddenSettings) { - sink << 1 << setting.first << setting.second.value; - } - sink << 0; - sink.flush(); } catch (Error & error) { auto ei = error.info(); // FIXME: add to trace? @@ -417,21 +400,6 @@ static void daemonInstance(AsyncIoRoot & aio, std::optional forceTr forceTrustClientOpt ? " by override" : "" ); - { - FdSource source(SUBDAEMON_SETTINGS_FD); - - /* Read the parent's settings. */ - while (readNum(source)) { - auto name = readString(source); - auto value = readString(source); - settings.set(name, value); - } - - if (close(SUBDAEMON_SETTINGS_FD) < 0) { - throw SysError("preparing subdaemon connection"); - } - } - // Background the daemon. if (setsid() == -1) { throw SysError("creating a new session");