about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-08-31T12·28+0200
committerEelco Dolstra <edolstra@gmail.com>2017-08-31T12·28+0200
commitc2154d4c8422ddc1c201d503bb52edff854af2ad (patch)
tree46b01c4081ef1ba5c16bf3b739218cbdbee1ebd6 /src
parent7d4a7136dba7ceb3d5b080b092eb76d23e2bb549 (diff)
Rename a few configuration options
In particular, drop the "build-" and "gc-" prefixes which are
pointless. So now you can say

  nix build --no-sandbox

instead of

  nix build --no-build-use-sandbox
Diffstat (limited to 'src')
-rw-r--r--src/libmain/shared.cc8
-rw-r--r--src/libstore/build.cc6
-rw-r--r--src/libstore/gc.cc10
-rw-r--r--src/libstore/globals.hh84
4 files changed, 60 insertions, 48 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 67178b4a8915..aa28ff2e53a4 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -171,7 +171,7 @@ struct LegacyArgs : public MixCommonArgs
         });
 
         mkFlag1('j', "max-jobs", "jobs", "maximum number of parallel builds", [=](std::string s) {
-            settings.set("build-max-jobs", s);
+            settings.set("max-jobs", s);
         });
 
         auto intSettingAlias = [&](char shortName, const std::string & longName,
@@ -181,9 +181,9 @@ struct LegacyArgs : public MixCommonArgs
             });
         };
 
-        intSettingAlias(0, "cores", "maximum number of CPU cores to use inside a build", "build-cores");
-        intSettingAlias(0, "max-silent-time", "number of seconds of silence before a build is killed", "build-max-silent-time");
-        intSettingAlias(0, "timeout", "number of seconds before a build is killed", "build-timeout");
+        intSettingAlias(0, "cores", "maximum number of CPU cores to use inside a build", "cores");
+        intSettingAlias(0, "max-silent-time", "number of seconds of silence before a build is killed", "max-silent-time");
+        intSettingAlias(0, "timeout", "number of seconds before a build is killed", "timeout");
 
         mkFlag(0, "readonly-mode", "do not write to the Nix store",
             &settings.readOnlyMode);
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 02dcd4536a5c..39f6128aafd6 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1740,11 +1740,11 @@ void DerivationGoal::startBuilder()
         if (settings.sandboxMode == smEnabled) {
             if (get(drv->env, "__noChroot") == "1")
                 throw Error(format("derivation '%1%' has '__noChroot' set, "
-                    "but that's not allowed when 'build-use-sandbox' is 'true'") % drvPath);
+                    "but that's not allowed when 'sandbox' is 'true'") % drvPath);
 #if __APPLE__
             if (additionalSandboxProfile != "")
                 throw Error(format("derivation '%1%' specifies a sandbox profile, "
-                    "but this is only allowed when 'build-use-sandbox' is 'relaxed'") % drvPath);
+                    "but this is only allowed when 'sandbox' is 'relaxed'") % drvPath);
 #endif
             useChroot = true;
         }
@@ -1832,7 +1832,7 @@ void DerivationGoal::startBuilder()
                     worker.store.computeFSClosure(worker.store.toStorePath(i.second.source), closure);
             } catch (InvalidPath & e) {
             } catch (Error & e) {
-                throw Error(format("while processing 'build-sandbox-paths': %s") % e.what());
+                throw Error(format("while processing 'sandbox-paths': %s") % e.what());
             }
         for (auto & i : closure)
             dirsInChroot[i] = i;
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index bd335fbb49e3..5e3958ea52a3 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -580,7 +580,7 @@ bool LocalStore::canReachRoot(GCState & state, PathSet & visited, const Path & p
     /* Don't delete this path if any of its referrers are alive. */
     queryReferrers(path, incoming);
 
-    /* If gc-keep-derivations is set and this is a derivation, then
+    /* If keep-derivations is set and this is a derivation, then
        don't delete the derivation if any of the outputs are alive. */
     if (state.gcKeepDerivations && isDerivation(path)) {
         PathSet outputs = queryDerivationOutputs(path);
@@ -589,7 +589,7 @@ bool LocalStore::canReachRoot(GCState & state, PathSet & visited, const Path & p
                 incoming.insert(i);
     }
 
-    /* If gc-keep-outputs is set, then don't delete this path if there
+    /* If keep-outputs is set, then don't delete this path if there
        are derivers of this path that are not garbage. */
     if (state.gcKeepOutputs) {
         PathSet derivers = queryValidDerivers(path);
@@ -704,9 +704,9 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
     state.gcKeepDerivations = settings.gcKeepDerivations;
 
     /* Using `--ignore-liveness' with `--delete' can have unintended
-       consequences if `gc-keep-outputs' or `gc-keep-derivations' are
-       true (the garbage collector will recurse into deleting the
-       outputs or derivers, respectively).  So disable them. */
+       consequences if `keep-outputs' or `keep-derivations' are true
+       (the garbage collector will recurse into deleting the outputs
+       or derivers, respectively).  So disable them. */
     if (options.action == GCOptions::gcDeleteSpecific && options.ignoreLiveness) {
         state.gcKeepOutputs = false;
         state.gcKeepDerivations = false;
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 9ebbf7b477bb..c20d147f5d34 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -89,8 +89,9 @@ public:
     Setting<bool> keepGoing{this, false, "keep-going",
         "Whether to keep building derivations when another build fails."};
 
-    Setting<bool> tryFallback{this, false, "build-fallback",
-        "Whether to fall back to building when substitution fails."};
+    Setting<bool> tryFallback{this, false, "fallback",
+        "Whether to fall back to building when substitution fails.",
+        {"build-fallback"}};
 
     /* Whether to show build log output in real time. */
     bool verboseBuild = true;
@@ -99,14 +100,15 @@ public:
        the log to show if a build fails. */
     size_t logLines = 10;
 
-    MaxBuildJobsSetting maxBuildJobs{this, 1, "build-max-jobs",
-        "Maximum number of parallel build jobs. \"auto\" means use number of cores."};
+    MaxBuildJobsSetting maxBuildJobs{this, 1, "max-jobs",
+        "Maximum number of parallel build jobs. \"auto\" means use number of cores.",
+        {"build-max-jobs"}};
 
-    Setting<unsigned int> buildCores{this, getDefaultCores(), "build-cores",
+    Setting<unsigned int> buildCores{this, getDefaultCores(), "cores",
         "Number of CPU cores to utilize in parallel within a build, "
         "i.e. by passing this number to Make via '-j'. 0 means that the "
         "number of actual CPU cores on the local host ought to be "
-        "auto-detected."};
+        "auto-detected.", {"build-cores"}};
 
     /* Read-only mode.  Don't copy stuff to the store, don't change
        the database. */
@@ -115,14 +117,15 @@ public:
     Setting<std::string> thisSystem{this, SYSTEM, "system",
         "The canonical Nix system name."};
 
-    Setting<time_t> maxSilentTime{this, 0, "build-max-silent-time",
+    Setting<time_t> maxSilentTime{this, 0, "max-silent-time",
         "The maximum time in seconds that a builer can go without "
         "producing any output on stdout/stderr before it is killed. "
-        "0 means infinity."};
+        "0 means infinity.",
+        {"build-max-silent-time"}};
 
-    Setting<time_t> buildTimeout{this, 0, "build-timeout",
+    Setting<time_t> buildTimeout{this, 0, "timeout",
         "The maximum duration in seconds that a builder can run. "
-        "0 means infinity."};
+        "0 means infinity.", {"build-timeout"}};
 
     Setting<bool> useBuildHook{this, true, "remote-builds",
         "Whether to use build hooks (for distributed builds)."};
@@ -149,27 +152,32 @@ public:
     Setting<bool> syncBeforeRegistering{this, false, "sync-before-registering",
         "Whether to call sync() before registering a path as valid."};
 
-    Setting<bool> useSubstitutes{this, true, "build-use-substitutes",
-        "Whether to use substitutes."};
+    Setting<bool> useSubstitutes{this, true, "use-substitutes",
+        "Whether to use substitutes.",
+        {"build-use-substitutes"}};
 
     Setting<std::string> buildUsersGroup{this, "", "build-users-group",
         "The Unix group that contains the build users."};
 
-    Setting<bool> impersonateLinux26{this, false, "build-impersonate-linux-26",
-        "Whether to impersonate a Linux 2.6 machine on newer kernels."};
+    Setting<bool> impersonateLinux26{this, false, "impersonate-linux-26",
+        "Whether to impersonate a Linux 2.6 machine on newer kernels.",
+        {"build-impersonate-linux-26"}};
 
-    Setting<bool> keepLog{this, true, "build-keep-log",
-        "Whether to store build logs."};
+    Setting<bool> keepLog{this, true, "keep-build-log",
+        "Whether to store build logs.",
+        {"build-keep-log"}};
 
-    Setting<bool> compressLog{this, true, "build-compress-log",
-        "Whether to compress logs."};
+    Setting<bool> compressLog{this, true, "compress-build-log",
+        "Whether to compress logs.",
+        {"build-compress-log"}};
 
-    Setting<unsigned long> maxLogSize{this, 0, "build-max-log-size",
+    Setting<unsigned long> maxLogSize{this, 0, "max-build-log-size",
         "Maximum number of bytes a builder can write to stdout/stderr "
-        "before being killed (0 means no limit)."};
+        "before being killed (0 means no limit).",
+        {"build-max-log-size"}};
 
-    /* When build-repeat > 0 and verboseBuild == true, whether to
-       print repeated builds (i.e. builds other than the first one) to
+    /* When buildRepeat > 0 and verboseBuild == true, whether to print
+       repeated builds (i.e. builds other than the first one) to
        stderr. Hack to prevent Hydra logs from being polluted. */
     bool printRepeatedBuilds = true;
 
@@ -180,18 +188,21 @@ public:
         "Whether to check if new GC roots can in fact be found by the "
         "garbage collector."};
 
-    Setting<bool> gcKeepOutputs{this, false, "gc-keep-outputs",
-        "Whether the garbage collector should keep outputs of live derivations."};
+    Setting<bool> gcKeepOutputs{this, false, "keep-outputs",
+        "Whether the garbage collector should keep outputs of live derivations.",
+        {"gc-keep-outputs"}};
 
-    Setting<bool> gcKeepDerivations{this, true, "gc-keep-derivations",
-        "Whether the garbage collector should keep derivers of live paths."};
+    Setting<bool> gcKeepDerivations{this, true, "keep-derivations",
+        "Whether the garbage collector should keep derivers of live paths.",
+        {"gc-keep-derivations"}};
 
     Setting<bool> autoOptimiseStore{this, false, "auto-optimise-store",
         "Whether to automatically replace files with identical contents with hard links."};
 
-    Setting<bool> envKeepDerivations{this, false, "env-keep-derivations",
+    Setting<bool> envKeepDerivations{this, false, "keep-env-derivations",
         "Whether to add derivations as a dependency of user environments "
-        "(to prevent them from being GCed)."};
+        "(to prevent them from being GCed).",
+        {"env-keep-derivations"}};
 
     /* Whether to lock the Nix client and worker to the same CPU. */
     bool lockCPU;
@@ -202,24 +213,25 @@ public:
     Setting<bool> enableNativeCode{this, false, "allow-unsafe-native-code-during-evaluation",
         "Whether builtin functions that allow executing native code should be enabled."};
 
-    Setting<SandboxMode> sandboxMode{this, smDisabled, "build-use-sandbox",
+    Setting<SandboxMode> sandboxMode{this, smDisabled, "sandbox",
         "Whether to enable sandboxed builds. Can be \"true\", \"false\" or \"relaxed\".",
-        {"build-use-chroot"}};
+        {"build-use-chroot", "build-use-sandbox"}};
 
-    Setting<PathSet> sandboxPaths{this, {}, "build-sandbox-paths",
+    Setting<PathSet> sandboxPaths{this, {}, "sandbox-paths",
         "The paths to make available inside the build sandbox.",
-        {"build-chroot-dirs"}};
+        {"build-chroot-dirs", "build-sandbox-paths"}};
 
-    Setting<PathSet> extraSandboxPaths{this, {}, "build-extra-sandbox-paths",
+    Setting<PathSet> extraSandboxPaths{this, {}, "extra-sandbox-paths",
         "Additional paths to make available inside the build sandbox.",
-        {"build-extra-chroot-dirs"}};
+        {"build-extra-chroot-dirs", "build-extra-sandbox-paths"}};
 
     Setting<bool> restrictEval{this, false, "restrict-eval",
         "Whether to restrict file system access to paths in $NIX_PATH, "
         "and to disallow fetching files from the network."};
 
-    Setting<size_t> buildRepeat{this, 0, "build-repeat",
-        "The number of times to repeat a build in order to verify determinism."};
+    Setting<size_t> buildRepeat{this, 0, "repeat",
+        "The number of times to repeat a build in order to verify determinism.",
+        {"build-repeat"}};
 
 #if __linux__
     Setting<std::string> sandboxShmSize{this, "50%", "sandbox-dev-shm-size",