1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-13 05:56:03 +01:00

Add a proper nix option for the external GC

This commit is contained in:
Théophane Hufschmitt 2022-04-11 10:20:37 +02:00
parent f76bfbfbd6
commit 240f1614d8
2 changed files with 10 additions and 2 deletions

View file

@ -269,8 +269,9 @@ void LocalStore::findRootsNoTemp(Roots & roots, bool censor)
throw SysError("cannot create Unix domain socket"); throw SysError("cannot create Unix domain socket");
closeOnExec(fd.get()); closeOnExec(fd.get());
// FIXME: Dont hardcode std::string socketPath = settings.gcSocketPath.get() != "auto"
string socketPath = getEnv("NIX_GC_SOCKET_PATH").value_or("/nix/var/nix/gc-socket/socket"); ? settings.gcSocketPath.get()
: stateDir.get() + gcSocketPath;
struct sockaddr_un addr; struct sockaddr_un addr;
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;

View file

@ -94,6 +94,13 @@ public:
Setting<std::string> storeUri{this, getEnv("NIX_REMOTE").value_or("auto"), "store", Setting<std::string> storeUri{this, getEnv("NIX_REMOTE").value_or("auto"), "store",
"The default Nix store to use."}; "The default Nix store to use."};
Setting<std::string> 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<bool> keepFailed{this, false, "keep-failed", Setting<bool> keepFailed{this, false, "keep-failed",
"Whether to keep temporary directories of failed builds."}; "Whether to keep temporary directories of failed builds."};