diff options
-rw-r--r-- | src/libstore/daemon.cc | 7 | ||||
-rw-r--r-- | src/libstore/daemon.hh | 2 | ||||
-rw-r--r-- | src/nix-daemon/nix-daemon.cc | 13 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc index 2e1d10bcc..cc1436f90 100644 --- a/src/libstore/daemon.cc +++ b/src/libstore/daemon.cc @@ -694,6 +694,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store, } void processConnection( + ref<Store> store, FdSource & from, FdSink & to, bool trusted, @@ -743,12 +744,6 @@ void processConnection( throw Error("if you run 'nix-daemon' as root, then you MUST set 'build-users-group'!"); #endif - /* Open the store. */ - Store::Params params; // FIXME: get params from somewhere - // Disable caching since the client already does that. - params["path-info-cache-size"] = "0"; - auto store = openStore(settings.storeUri, params); - store->createUser(userName, userId); tunnelLogger->stopWork(); diff --git a/src/libstore/daemon.hh b/src/libstore/daemon.hh index 6d4015e34..fa26ba9c2 100644 --- a/src/libstore/daemon.hh +++ b/src/libstore/daemon.hh @@ -1,8 +1,10 @@ #include "serialise.hh" +#include "store-api.hh" namespace nix::daemon { void processConnection( + ref<Store> store, FdSource & from, FdSink & to, bool trusted, diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc index 67bf4dfeb..da17ddcba 100644 --- a/src/nix-daemon/nix-daemon.cc +++ b/src/nix-daemon/nix-daemon.cc @@ -140,6 +140,15 @@ static PeerInfo getPeerInfo(int remote) #define SD_LISTEN_FDS_START 3 +static ref<Store> openUncachedStore() +{ + Store::Params params; // FIXME: get params from somewhere + // Disable caching since the client already does that. + params["path-info-cache-size"] = "0"; + return openStore(settings.storeUri, params); +} + + static void daemonLoop(char * * argv) { if (chdir("/") == -1) @@ -230,7 +239,7 @@ static void daemonLoop(char * * argv) /* Handle the connection. */ FdSource from(remote.get()); FdSink to(remote.get()); - processConnection(from, to, trusted, user, peer.uid); + processConnection(openUncachedStore(), from, to, trusted, user, peer.uid); exit(0); }, options); @@ -312,7 +321,7 @@ static int _main(int argc, char * * argv) } else { FdSource from(STDIN_FILENO); FdSink to(STDOUT_FILENO); - processConnection(from, to, true, "root", 0); + processConnection(openUncachedStore(), from, to, true, "root", 0); } } else { daemonLoop(argv); |