From ad0ab74eefcd2f5f3837635a0487280775a0a3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 27 Mar 2014 22:08:53 +0100 Subject: [PATCH] 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'. --- nix/nix-daemon/guix-daemon.cc | 11 +++++++---- 1 file 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");