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/libstore/build.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'nix/libstore') diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc index fe7bf79069..9f1f88933a 100644 --- a/nix/libstore/build.cc +++ b/nix/libstore/build.cc @@ -614,9 +614,7 @@ HookInstance::HookInstance() { debug("starting build hook"); - Path buildHook = getEnv("NIX_BUILD_HOOK"); - if (string(buildHook, 0, 1) != "/") buildHook = settings.nixLibexecDir + "/nix/" + buildHook; - buildHook = canonPath(buildHook); + const Path &buildHook = settings.guixProgram; /* Create a pipe to get the output of the child. */ fromHook.create(); @@ -642,13 +640,14 @@ HookInstance::HookInstance() if (dup2(builderOut.writeSide, 4) == -1) throw SysError("dupping builder's stdout/stderr"); - execl(buildHook.c_str(), buildHook.c_str(), settings.thisSystem.c_str(), + execl(buildHook.c_str(), buildHook.c_str(), "offload", + settings.thisSystem.c_str(), (format("%1%") % settings.maxSilentTime).str().c_str(), (format("%1%") % settings.printBuildTrace).str().c_str(), (format("%1%") % settings.buildTimeout).str().c_str(), NULL); - throw SysError(format("executing `%1%'") % buildHook); + throw SysError(format("executing `%1% offload'") % buildHook); }); pid.setSeparatePG(true); @@ -1581,7 +1580,7 @@ void DerivationGoal::buildDone() HookReply DerivationGoal::tryBuildHook() { - if (!settings.useBuildHook || getEnv("NIX_BUILD_HOOK") == "") return rpDecline; + if (!settings.useBuildHook) return rpDecline; if (!worker.hook) worker.hook = std::shared_ptr(new HookInstance); -- cgit v1.2.3