Skip to content

Commit

Permalink
split configuration file page into sections
Browse files Browse the repository at this point in the history
this makes it easier to scan for specific information, such as the
format of command line flags
  • Loading branch information
fricklerhandwerk committed Jun 20, 2023
1 parent f2b54e3 commit 38bd1cc
Showing 1 changed file with 32 additions and 21 deletions.
53 changes: 32 additions & 21 deletions doc/manual/src/command-ref/conf-file-prefix.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

# Description

Nix supports a variety of configuration settings, which are read from configuration files or taken as command line flags.

## Configuration file

By default Nix reads settings from the following places:

- The system-wide configuration file `sysconfdir/nix/nix.conf` (i.e. `/etc/nix/nix.conf` on most systems), or `$NIX_CONF_DIR/nix.conf` if [`NIX_CONF_DIR`](./env-common.md#env-NIX_CONF_DIR) is set.
Expand All @@ -18,32 +22,39 @@ By default Nix reads settings from the following places:

- If [`NIX_CONFIG`](./env-common.md#env-NIX_CONFIG) is set, its contents are treated as the contents of a configuration file.

The configuration files consist of `name = value` pairs, one per
line. Other files can be included with a line like `include path`,
where *path* is interpreted relative to the current conf file and a
missing file is an error unless `!include` is used instead. Comments
start with a `#` character.
### File format

Configuration files consist of `name = value` pairs, one per line.
Comments start with a `#` character.

Example:

```
keep-outputs = true # Nice for developers
keep-derivations = true # Idem
```

Other files can be included with a line like `include <path>`, where `<path>` is interpreted relative to the current configuration file.
A missing file is an error unless `!include` is used instead.

A configuration setting usually overrides any previous value.
However, you can prefix the name of the setting by `extra-` to *append* to the previous value.

Here is an example configuration file:
For instance,

keep-outputs = true # Nice for developers
keep-derivations = true # Idem
```
substituters = a b
extra-substituters = c d
```

You can override settings on the command line using the `--option`
flag, e.g. `--option keep-outputs false`. Every configuration setting
also has a corresponding command line flag, e.g. `--max-jobs 16`; for
Boolean settings, there are two flags to enable or disable the setting
(e.g. `--keep-failed` and `--no-keep-failed`).
defines the `substituters` setting to be `a b c d`.

A configuration setting usually overrides any previous value. However,
you can prefix the name of the setting by `extra-` to *append* to the
previous value. For instance,
## Command line flags

substituters = a b
extra-substituters = c d
Every configuration setting has a corresponding command line flag (e.g. `--max-jobs 16`).
Boolean settings do not need an argument, and can be explicitly disabled with the `no-` prefix (e.g. `--keep-failed` and `--no-keep-failed`).

defines the `substituters` setting to be `a b c d`. This is also
available as a command line flag (e.g. `--extra-substituters`).
Existing settings can be appended to using the `extra-` prefix (e.g. `--extra-substituters`).

The following settings are currently available:
# Available settings

0 comments on commit 38bd1cc

Please sign in to comment.