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'.
This commit is contained in:
Ludovic Courtès 2014-03-27 22:08:53 +01:00
parent 15f682f4a3
commit ad0ab74eef
1 changed files with 7 additions and 4 deletions

View File

@ -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");