summaryrefslogtreecommitdiff
path: root/nix/nix-daemon
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-09-17 16:17:20 +0200
committerLudovic Courtès <ludo@gnu.org>2019-09-17 16:27:15 +0200
commit9ff87bb99614923fa3336ab4bbf22e3444709b48 (patch)
treefa169a6cc0fdc8d92bb4c4a4f265afc2ba29a890 /nix/nix-daemon
parentae71bef532d6b1c9d1481a3ac65827f148b1e45b (diff)
parent9e8e252026f558933bdd9cfc26a75d13954b3e8e (diff)
downloadguix-patches-9ff87bb99614923fa3336ab4bbf22e3444709b48.tar
guix-patches-9ff87bb99614923fa3336ab4bbf22e3444709b48.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'nix/nix-daemon')
-rw-r--r--nix/nix-daemon/guix-daemon.cc20
-rw-r--r--nix/nix-daemon/nix-daemon.cc17
2 files changed, 16 insertions, 21 deletions
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index f47d142612..6f9c404c8d 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -466,23 +466,15 @@ main (int argc, char *argv[])
{
settings.processEnvironment ();
- /* Use our substituter by default. */
- settings.substituters.clear ();
+ /* Enable substitutes by default. */
settings.set ("build-use-substitutes", "true");
/* Use our substitute server by default. */
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;
@@ -497,14 +489,6 @@ main (int argc, char *argv[])
printMsg(lvlDebug,
format ("build log compression: %1%") % settings.logCompression);
- if (settings.useSubstitutes)
- settings.substituters.push_back (settings.nixLibexecDir
- + "/substitute");
- else
- /* Clear the substituter list to make sure nothing ever gets
- substituted, regardless of the client's settings. */
- settings.substituters.clear ();
-
if (geteuid () == 0 && settings.buildUsersGroup.empty ())
fprintf (stderr, _("warning: daemon is running as root, so \
using `--build-users-group' is highly recommended\n"));
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 56137701a1..1163a249d1 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -1,3 +1,4 @@
+#include "config.h"
#include "shared.hh"
#include "local-store.hh"
#include "util.hh"
@@ -580,8 +581,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);
@@ -590,8 +597,12 @@ static void performOp(bool trusted, unsigned int clientVersion,
if (GET_PROTOCOL_MINOR(clientVersion) >= 6
&& GET_PROTOCOL_MINOR(clientVersion) < 0x61)
settings.set("build-cores", std::to_string(readInt(from)));
- if (GET_PROTOCOL_MINOR(clientVersion) >= 10)
- settings.set("build-use-substitutes", readInt(from) ? "true" : "false");
+ if (GET_PROTOCOL_MINOR(clientVersion) >= 10) {
+ if (settings.useSubstitutes)
+ settings.set("build-use-substitutes", readInt(from) ? "true" : "false");
+ else
+ readInt(from); // substitutes remain disabled
+ }
if (GET_PROTOCOL_MINOR(clientVersion) >= 12) {
unsigned int n = readInt(from);
for (unsigned int i = 0; i < n; i++) {