split configuration file page into sections

this makes it easier to scan for specific information, such as the
format of command line flags
This commit is contained in:
fricklerhandwerk 2023-06-17 03:53:37 +02:00 committed by Valentin Gagarin
parent f2b54e3b71
commit 38bd1cc9bc

View file

@ -4,6 +4,10 @@
# Description # 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: 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. - 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.
@ -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. - 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 ### File format
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.
Here is an example configuration file: Configuration files consist of `name = value` pairs, one per line.
Comments start with a `#` character.
Example:
```
keep-outputs = true # Nice for developers keep-outputs = true # Nice for developers
keep-derivations = true # Idem keep-derivations = true # Idem
```
You can override settings on the command line using the `--option` Other files can be included with a line like `include <path>`, where `<path>` is interpreted relative to the current configuration file.
flag, e.g. `--option keep-outputs false`. Every configuration setting A missing file is an error unless `!include` is used instead.
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`).
A configuration setting usually overrides any previous value. However, A configuration setting usually overrides any previous value.
you can prefix the name of the setting by `extra-` to *append* to the However, you can prefix the name of the setting by `extra-` to *append* to the previous value.
previous value. For instance,
For instance,
```
substituters = a b substituters = a b
extra-substituters = c d extra-substituters = c d
```
defines the `substituters` setting to be `a b c d`. This is also defines the `substituters` setting to be `a b c d`.
available as a command line flag (e.g. `--extra-substituters`).
The following settings are currently available: ## Command line flags
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`).
Existing settings can be appended to using the `extra-` prefix (e.g. `--extra-substituters`).
# Available settings