diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index 104405d6e..98a7866a1 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -269,8 +269,9 @@ void LocalStore::findRootsNoTemp(Roots & roots, bool censor) throw SysError("cannot create Unix domain socket"); closeOnExec(fd.get()); - // FIXME: Don’t hardcode - string socketPath = getEnv("NIX_GC_SOCKET_PATH").value_or("/nix/var/nix/gc-socket/socket"); + std::string socketPath = settings.gcSocketPath.get() != "auto" + ? settings.gcSocketPath.get() + : stateDir.get() + gcSocketPath; struct sockaddr_un addr; addr.sun_family = AF_UNIX; diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index feb6899cd..d8db8be76 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -94,6 +94,13 @@ public: Setting storeUri{this, getEnv("NIX_REMOTE").value_or("auto"), "store", "The default Nix store to use."}; + Setting gcSocketPath { + this, + getEnv("NIX_GC_SOCKET_PATH").value_or("auto"), + "gc-socket-path", + "Path to the socket used to communicate with an external GC." + }; + Setting keepFailed{this, false, "keep-failed", "Whether to keep temporary directories of failed builds."};