Skip to content

Commit c2154d4

Browse files
committed
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
1 parent 7d4a713 commit c2154d4

File tree

16 files changed

+113
-104
lines changed

16 files changed

+113
-104
lines changed

doc/manual/command-ref/conf-file.xml

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,20 @@ Comments start with a <literal>#</literal> character. Here is an
4545
example configuration file:</para>
4646

4747
<programlisting>
48-
gc-keep-outputs = true # Nice for developers
49-
gc-keep-derivations = true # Idem
50-
env-keep-derivations = false
48+
keep-outputs = true # Nice for developers
49+
keep-derivations = true # Idem
5150
</programlisting>
5251

5352
<para>You can override settings on the command line using the
54-
<option>--option</option> flag, e.g. <literal>--option gc-keep-outputs
53+
<option>--option</option> flag, e.g. <literal>--option keep-outputs
5554
false</literal>.</para>
5655

5756
<para>The following settings are currently available:
5857

5958
<variablelist>
6059

6160

62-
<varlistentry xml:id="conf-gc-keep-outputs"><term><literal>gc-keep-outputs</literal></term>
61+
<varlistentry xml:id="conf-keep-outputs"><term><literal>keep-outputs</literal></term>
6362

6463
<listitem><para>If <literal>true</literal>, the garbage collector
6564
will keep the outputs of non-garbage derivations. If
@@ -76,7 +75,7 @@ false</literal>.</para>
7675
</varlistentry>
7776

7877

79-
<varlistentry xml:id="conf-gc-keep-derivations"><term><literal>gc-keep-derivations</literal></term>
78+
<varlistentry xml:id="conf-keep-derivations"><term><literal>keep-derivations</literal></term>
8079

8180
<listitem><para>If <literal>true</literal> (default), the garbage
8281
collector will keep the derivations from which non-garbage store
@@ -88,12 +87,12 @@ false</literal>.</para>
8887
traceability (e.g., it allows you to ask with what dependencies or
8988
options a store path was built), so by default this option is on.
9089
Turn it off to save a bit of disk space (or a lot if
91-
<literal>gc-keep-outputs</literal> is also turned on).</para></listitem>
90+
<literal>keep-outputs</literal> is also turned on).</para></listitem>
9291

9392
</varlistentry>
9493

9594

96-
<varlistentry><term><literal>env-keep-derivations</literal></term>
95+
<varlistentry><term><literal>keep-env-derivations</literal></term>
9796

9897
<listitem><para>If <literal>false</literal> (default), derivations
9998
are not stored in Nix user environments. That is, the derivation
@@ -105,19 +104,19 @@ false</literal>.</para>
105104
garbage-collected until the user environment generation is deleted
106105
(<command>nix-env --delete-generations</command>). To prevent
107106
build-time-only dependencies from being collected, you should also
108-
turn on <literal>gc-keep-outputs</literal>.</para>
107+
turn on <literal>keep-outputs</literal>.</para>
109108

110109
<para>The difference between this option and
111-
<literal>gc-keep-derivations</literal> is that this one is
110+
<literal>keep-derivations</literal> is that this one is
112111
“sticky”: it applies to any user environment created while this
113-
option was enabled, while <literal>gc-keep-derivations</literal>
112+
option was enabled, while <literal>keep-derivations</literal>
114113
only applies at the moment the garbage collector is
115114
run.</para></listitem>
116115

117116
</varlistentry>
118117

119118

120-
<varlistentry xml:id="conf-build-max-jobs"><term><literal>build-max-jobs</literal></term>
119+
<varlistentry xml:id="conf-max-jobs"><term><literal>max-jobs</literal></term>
121120

122121
<listitem><para>This option defines the maximum number of jobs
123122
that Nix will try to build in parallel. The default is
@@ -130,7 +129,7 @@ false</literal>.</para>
130129
</varlistentry>
131130

132131

133-
<varlistentry xml:id="conf-build-cores"><term><literal>build-cores</literal></term>
132+
<varlistentry xml:id="conf-cores"><term><literal>cores</literal></term>
134133

135134
<listitem><para>Sets the value of the
136135
<envar>NIX_BUILD_CORES</envar> environment variable in the
@@ -149,7 +148,7 @@ false</literal>.</para>
149148
</varlistentry>
150149

151150

152-
<varlistentry xml:id="conf-build-max-silent-time"><term><literal>build-max-silent-time</literal></term>
151+
<varlistentry xml:id="conf-max-silent-time"><term><literal>max-silent-time</literal></term>
153152

154153
<listitem>
155154

@@ -170,7 +169,7 @@ false</literal>.</para>
170169
</varlistentry>
171170

172171

173-
<varlistentry xml:id="conf-build-timeout"><term><literal>build-timeout</literal></term>
172+
<varlistentry xml:id="conf-timeout"><term><literal>timeout</literal></term>
174173

175174
<listitem>
176175

@@ -190,7 +189,7 @@ false</literal>.</para>
190189
</varlistentry>
191190

192191

193-
<varlistentry xml:id="conf-build-max-log-size"><term><literal>build-max-log-size</literal></term>
192+
<varlistentry xml:id="conf-max-build-log-size"><term><literal>max-build-log-size</literal></term>
194193

195194
<listitem>
196195

@@ -245,7 +244,7 @@ false</literal>.</para>
245244
</varlistentry>
246245

247246

248-
<varlistentry><term><literal>build-use-sandbox</literal></term>
247+
<varlistentry><term><literal>sandbox</literal></term>
249248

250249
<listitem><para>If set to <literal>true</literal>, builds will be
251250
performed in a <emphasis>sandboxed environment</emphasis>, i.e.,
@@ -254,7 +253,7 @@ false</literal>.</para>
254253
directory, private versions of <filename>/proc</filename>,
255254
<filename>/dev</filename>, <filename>/dev/shm</filename> and
256255
<filename>/dev/pts</filename> (on Linux), and the paths configured with the
257-
<link linkend='conf-build-sandbox-paths'><literal>build-sandbox-paths</literal>
256+
<link linkend='conf-sandbox-paths'><literal>sandbox-paths</literal>
258257
option</link>. This is useful to prevent undeclared dependencies
259258
on files in directories such as <filename>/usr/bin</filename>. In
260259
addition, on Linux, builds run in private PID, mount, network, IPC
@@ -280,8 +279,8 @@ false</literal>.</para>
280279
</varlistentry>
281280

282281

283-
<varlistentry xml:id="conf-build-sandbox-paths">
284-
<term><literal>build-sandbox-paths</literal></term>
282+
<varlistentry xml:id="conf-sandbox-paths">
283+
<term><literal>sandbox-paths</literal></term>
285284

286285
<listitem><para>A list of paths bind-mounted into Nix sandbox
287286
environments. You can use the syntax
@@ -303,17 +302,17 @@ false</literal>.</para>
303302
</varlistentry>
304303

305304

306-
<varlistentry xml:id="conf-build-extra-sandbox-paths">
305+
<varlistentry xml:id="conf-extra-sandbox-paths">
307306
<term><literal>build-extra-sandbox-paths</literal></term>
308307

309308
<listitem><para>A list of additional paths appended to
310-
<option>build-sandbox-paths</option>. Useful if you want to extend
309+
<option>sandbox-paths</option>. Useful if you want to extend
311310
its default value.</para></listitem>
312311

313312
</varlistentry>
314313

315314

316-
<varlistentry><term><literal>build-use-substitutes</literal></term>
315+
<varlistentry><term><literal>use-substitutes</literal></term>
317316

318317
<listitem><para>If set to <literal>true</literal> (default), Nix
319318
will use binary substitutes if available. This option can be
@@ -322,7 +321,7 @@ false</literal>.</para>
322321
</varlistentry>
323322

324323

325-
<varlistentry><term><literal>build-fallback</literal></term>
324+
<varlistentry><term><literal>fallback</literal></term>
326325

327326
<listitem><para>If set to <literal>true</literal>, Nix will fall
328327
back to building from source if a binary substitute fails. This
@@ -332,7 +331,7 @@ false</literal>.</para>
332331
</varlistentry>
333332

334333

335-
<varlistentry><term><literal>build-keep-log</literal></term>
334+
<varlistentry><term><literal>keep-build-log</literal></term>
336335

337336
<listitem><para>If set to <literal>true</literal> (the default),
338337
Nix will write the build log of a derivation (i.e. the standard
@@ -344,7 +343,7 @@ false</literal>.</para>
344343
</varlistentry>
345344

346345

347-
<varlistentry><term><literal>build-compress-log</literal></term>
346+
<varlistentry><term><literal>compress-build-log</literal></term>
348347

349348
<listitem><para>If set to <literal>true</literal> (the default),
350349
build logs written to <filename>/nix/var/log/nix/drvs</filename>
@@ -597,7 +596,7 @@ password <replaceable>my-password</replaceable>
597596
<para>Pass a list of files and directories to be included in the
598597
sandbox for this build. One entry per line, terminated by an empty
599598
line. Entries have the same format as
600-
<literal>build-sandbox-paths</literal>.</para>
599+
<literal>sandbox-paths</literal>.</para>
601600

602601
</listitem>
603602

@@ -608,7 +607,7 @@ password <replaceable>my-password</replaceable>
608607
</varlistentry>
609608

610609

611-
<varlistentry xml:id="conf-build-repeat"><term><literal>build-repeat</literal></term>
610+
<varlistentry xml:id="conf-repeat"><term><literal>repeat</literal></term>
612611

613612
<listitem><para>How many times to repeat builds to check whether
614613
they are deterministic. The default value is 0. If the value is
@@ -651,7 +650,7 @@ password <replaceable>my-password</replaceable>
651650
as <command>sudo</command> or <command>ping</command> will
652651
fail. (Note that in sandbox builds, no such programs are available
653652
unless you bind-mount them into the sandbox via the
654-
<option>build-sandbox-paths</option> option.) You can allow the
653+
<option>sandbox-paths</option> option.) You can allow the
655654
use of such programs by enabling this option. This is impure and
656655
usually undesirable, but may be useful in certain scenarios
657656
(e.g. to spin up containers or set up userspace network interfaces

doc/manual/command-ref/nix-store.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,9 @@ options control what gets deleted and in what order:
397397
</para>
398398

399399
<para>The behaviour of the collector is also influenced by the <link
400-
linkend="conf-gc-keep-outputs"><literal>gc-keep-outputs</literal></link>
400+
linkend="conf-keep-outputs"><literal>keep-outputs</literal></link>
401401
and <link
402-
linkend="conf-gc-keep-derivations"><literal>gc-keep-derivations</literal></link>
402+
linkend="conf-keep-derivations"><literal>keep-derivations</literal></link>
403403
variables in the Nix configuration file.</para>
404404

405405
<para>With <option>--delete</option>, the collector prints the total

doc/manual/command-ref/opt-common.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
perform in parallel to the specified number. Specify
9595
<literal>auto</literal> to use the number of CPUs in the system.
9696
The default is specified by the <link
97-
linkend='conf-build-max-jobs'><literal>build-max-jobs</literal></link>
97+
linkend='conf-max-jobs'><literal>max-jobs</literal></link>
9898
configuration setting, which itself defaults to
9999
<literal>1</literal>. A higher value is useful on SMP systems or to
100100
exploit I/O latency.</para></listitem>
@@ -112,7 +112,7 @@
112112
<literal>true</literal>, the builder passes the
113113
<option>-j<replaceable>N</replaceable></option> flag to GNU Make.
114114
It defaults to the value of the <link
115-
linkend='conf-build-cores'><literal>build-cores</literal></link>
115+
linkend='conf-cores'><literal>cores</literal></link>
116116
configuration setting, if set, or <literal>1</literal> otherwise.
117117
The value <literal>0</literal> means that the builder should use all
118118
available CPU cores in the system.</para></listitem>
@@ -125,7 +125,7 @@
125125
<listitem><para>Sets the maximum number of seconds that a builder
126126
can go without producing any data on standard output or standard
127127
error. The default is specified by the <link
128-
linkend='conf-build-max-silent-time'><literal>build-max-silent-time</literal></link>
128+
linkend='conf-max-silent-time'><literal>max-silent-time</literal></link>
129129
configuration setting. <literal>0</literal> means no
130130
time-out.</para></listitem>
131131

@@ -135,7 +135,7 @@
135135

136136
<listitem><para>Sets the maximum number of seconds that a builder
137137
can run. The default is specified by the <link
138-
linkend='conf-build-timeout'><literal>build-timeout</literal></link>
138+
linkend='conf-timeout'><literal>timeout</literal></link>
139139
configuration setting. <literal>0</literal> means no
140140
timeout.</para></listitem>
141141

scripts/install-darwin-multi-user.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,9 +744,9 @@ place_nix_configuration() {
744744
cat <<EOF > "$SCRATCH/nix.conf"
745745
build-users-group = $NIX_BUILD_GROUP_NAME
746746
747-
build-max-jobs = $NIX_USER_COUNT
748-
build-cores = 1
749-
build-use-sandbox = false
747+
max-jobs = $NIX_USER_COUNT
748+
cores = 1
749+
sandbox = false
750750
751751
binary-caches = https://cache.nixos.org/
752752
trusted-binary-caches =

src/libmain/shared.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ struct LegacyArgs : public MixCommonArgs
171171
});
172172

173173
mkFlag1('j', "max-jobs", "jobs", "maximum number of parallel builds", [=](std::string s) {
174-
settings.set("build-max-jobs", s);
174+
settings.set("max-jobs", s);
175175
});
176176

177177
auto intSettingAlias = [&](char shortName, const std::string & longName,
@@ -181,9 +181,9 @@ struct LegacyArgs : public MixCommonArgs
181181
});
182182
};
183183

184-
intSettingAlias(0, "cores", "maximum number of CPU cores to use inside a build", "build-cores");
185-
intSettingAlias(0, "max-silent-time", "number of seconds of silence before a build is killed", "build-max-silent-time");
186-
intSettingAlias(0, "timeout", "number of seconds before a build is killed", "build-timeout");
184+
intSettingAlias(0, "cores", "maximum number of CPU cores to use inside a build", "cores");
185+
intSettingAlias(0, "max-silent-time", "number of seconds of silence before a build is killed", "max-silent-time");
186+
intSettingAlias(0, "timeout", "number of seconds before a build is killed", "timeout");
187187

188188
mkFlag(0, "readonly-mode", "do not write to the Nix store",
189189
&settings.readOnlyMode);

src/libstore/build.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,11 +1740,11 @@ void DerivationGoal::startBuilder()
17401740
if (settings.sandboxMode == smEnabled) {
17411741
if (get(drv->env, "__noChroot") == "1")
17421742
throw Error(format("derivation '%1%' has '__noChroot' set, "
1743-
"but that's not allowed when 'build-use-sandbox' is 'true'") % drvPath);
1743+
"but that's not allowed when 'sandbox' is 'true'") % drvPath);
17441744
#if __APPLE__
17451745
if (additionalSandboxProfile != "")
17461746
throw Error(format("derivation '%1%' specifies a sandbox profile, "
1747-
"but this is only allowed when 'build-use-sandbox' is 'relaxed'") % drvPath);
1747+
"but this is only allowed when 'sandbox' is 'relaxed'") % drvPath);
17481748
#endif
17491749
useChroot = true;
17501750
}
@@ -1832,7 +1832,7 @@ void DerivationGoal::startBuilder()
18321832
worker.store.computeFSClosure(worker.store.toStorePath(i.second.source), closure);
18331833
} catch (InvalidPath & e) {
18341834
} catch (Error & e) {
1835-
throw Error(format("while processing 'build-sandbox-paths': %s") % e.what());
1835+
throw Error(format("while processing 'sandbox-paths': %s") % e.what());
18361836
}
18371837
for (auto & i : closure)
18381838
dirsInChroot[i] = i;

src/libstore/gc.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ bool LocalStore::canReachRoot(GCState & state, PathSet & visited, const Path & p
580580
/* Don't delete this path if any of its referrers are alive. */
581581
queryReferrers(path, incoming);
582582

583-
/* If gc-keep-derivations is set and this is a derivation, then
583+
/* If keep-derivations is set and this is a derivation, then
584584
don't delete the derivation if any of the outputs are alive. */
585585
if (state.gcKeepDerivations && isDerivation(path)) {
586586
PathSet outputs = queryDerivationOutputs(path);
@@ -589,7 +589,7 @@ bool LocalStore::canReachRoot(GCState & state, PathSet & visited, const Path & p
589589
incoming.insert(i);
590590
}
591591

592-
/* If gc-keep-outputs is set, then don't delete this path if there
592+
/* If keep-outputs is set, then don't delete this path if there
593593
are derivers of this path that are not garbage. */
594594
if (state.gcKeepOutputs) {
595595
PathSet derivers = queryValidDerivers(path);
@@ -704,9 +704,9 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
704704
state.gcKeepDerivations = settings.gcKeepDerivations;
705705

706706
/* Using `--ignore-liveness' with `--delete' can have unintended
707-
consequences if `gc-keep-outputs' or `gc-keep-derivations' are
708-
true (the garbage collector will recurse into deleting the
709-
outputs or derivers, respectively). So disable them. */
707+
consequences if `keep-outputs' or `keep-derivations' are true
708+
(the garbage collector will recurse into deleting the outputs
709+
or derivers, respectively). So disable them. */
710710
if (options.action == GCOptions::gcDeleteSpecific && options.ignoreLiveness) {
711711
state.gcKeepOutputs = false;
712712
state.gcKeepDerivations = false;

0 commit comments

Comments
 (0)