summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-03-27 22:08:53 +0100
committerLudovic Courtès <ludo@gnu.org>2014-03-27 23:56:47 +0100
commitad0ab74eefcd2f5f3837635a0487280775a0a3a7 (patch)
tree63027d6690c9b2a2e2796d94d681526765b0f870
parent15f682f4a3ae8974aad7a2a2fc9079487ca9180a (diff)
downloadguix-ad0ab74eefcd2f5f3837635a0487280775a0a3a7.tar.gz
daemon: Change some options via 'settings.set'.
* nix/nix-daemon/guix-daemon.cc (parse_opt): Use 'settings.set' instead
  of direct field access for 'buildCores', 'maxBuildJobs', and
  'useSubstitutes'.
  (main): Call 'settings.update' after 'argp_parse'.
-rw-r--r--nix/nix-daemon/guix-daemon.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index 086b846ce1..b083fc2a44 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -187,7 +187,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
 	}
       break;
     case GUIX_OPT_NO_SUBSTITUTES:
-      settings.useSubstitutes = false;
+      settings.set ("build-use-substitutes", "false");
       break;
     case GUIX_OPT_NO_BUILD_HOOK:
       settings.useBuildHook = false;
@@ -202,10 +202,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
       settings.gcKeepDerivations = string_to_bool (arg);
       break;
     case 'c':
-      settings.buildCores = atoi (arg);
+      settings.set ("build-cores", arg);
       break;
     case 'M':
-      settings.maxBuildJobs = atoi (arg);
+      settings.set ("build-max-jobs", arg);
       break;
     case GUIX_OPT_SYSTEM:
       settings.thisSystem = arg;
@@ -263,7 +263,7 @@ main (int argc, char *argv[])
 
       /* Use our substituter by default.  */
       settings.substituters.clear ();
-      settings.useSubstitutes = true;
+      settings.set ("build-use-substitutes", "true");
 
 #ifdef HAVE_DAEMON_OFFLOAD_HOOK
       /* Use our build hook for distributed builds by default.  */
@@ -282,6 +282,9 @@ main (int argc, char *argv[])
 
       argp_parse (&argp, argc, argv, 0, 0, 0);
 
+      /* Effect all the changes made via 'settings.set'.  */
+      settings.update ();
+
       if (settings.useSubstitutes)
 	{
 	  string subs = getEnv ("NIX_SUBSTITUTERS", "default");