From bc69ea2d605810cc32e13ed03d5848b8dc358b61 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 3 Sep 2019 22:11:47 +0200 Subject: daemon: Run 'guix offload' directly. * nix/scripts/offload.in: Remove. * nix/local.mk (nodist_pkglibexec_SCRIPTS) [BUILD_DAEMON_OFFLOAD]: Remove 'scripts/offload'. * config-daemon.ac: Don't output 'nix/scripts/offload'. * build-aux/pre-inst-env.in: Don't set 'NIX_BUILD_HOOK'. * nix/libstore/build.cc (HookInstance::HookInstance): Run 'guix offload'. (DerivationGoal::tryBuildHook): Remove reference to 'NIX_BUILD_HOOK'. * nix/nix-daemon/guix-daemon.cc (main) [HAVE_DAEMON_OFFLOAD_HOOK]: Don't set 'NIX_BUILD_HOOK'. * nix/nix-daemon/nix-daemon.cc (performOp) [!HAVE_DAEMON_OFFLOAD_HOOK]: Leave 'settings.useBuildHook' unchanged. --- nix/nix-daemon/guix-daemon.cc | 9 +-------- nix/nix-daemon/nix-daemon.cc | 8 +++++++- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'nix/nix-daemon') diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc index f47d142612..73962af584 100644 --- a/nix/nix-daemon/guix-daemon.cc +++ b/nix/nix-daemon/guix-daemon.cc @@ -474,15 +474,8 @@ main (int argc, char *argv[]) settings.set ("substitute-urls", GUIX_SUBSTITUTE_URLS); #ifdef HAVE_DAEMON_OFFLOAD_HOOK - /* Use our build hook for distributed builds by default. */ + /* Use 'guix offload' for distributed builds by default. */ settings.useBuildHook = true; - if (getenv ("NIX_BUILD_HOOK") == NULL) - { - std::string build_hook; - - build_hook = settings.nixLibexecDir + "/offload"; - setenv ("NIX_BUILD_HOOK", build_hook.c_str (), 1); - } #else /* We are not installing any build hook, so disable it. */ settings.useBuildHook = false; diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc index 56137701a1..f29bcd2eab 100644 --- a/nix/nix-daemon/nix-daemon.cc +++ b/nix/nix-daemon/nix-daemon.cc @@ -580,8 +580,14 @@ static void performOp(bool trusted, unsigned int clientVersion, settings.set("build-max-silent-time", std::to_string(readInt(from))); } - if (GET_PROTOCOL_MINOR(clientVersion) >= 2) + if (GET_PROTOCOL_MINOR(clientVersion) >= 2) { +#ifdef HAVE_DAEMON_OFFLOAD_HOOK settings.useBuildHook = readInt(from) != 0; +#else + readInt(from); // ignore the user's setting +#endif + } + if (GET_PROTOCOL_MINOR(clientVersion) >= 4) { settings.buildVerbosity = (Verbosity) readInt(from); logType = (LogType) readInt(from); -- cgit v1.2.3