.\" -*- mode: troff; coding: utf-8 -*- .TH "nix.conf" "5" "" .SH Name \fCnix.conf\fR - Nix configuration file .SH Description By default Nix reads settings from the following places: .IP "\(bu" 2 The system-wide configuration file \fCsysconfdir/nix/nix.conf\fR (i.e. \fC/etc/nix/nix.conf\fR on most systems), or \fC$NIX_CONF_DIR/nix.conf\fR if \fCNIX_CONF_DIR\fR is set. Values loaded in this file are not forwarded to the Nix daemon. The client assumes that the daemon has already loaded them. .IP "\(bu" 2 If \fCNIX_USER_CONF_FILES\fR is set, then each path separated by \fC:\fR will be loaded in reverse order. .IP Otherwise it will look for \fCnix/nix.conf\fR files in \fCXDG_CONFIG_DIRS\fR and \fCXDG_CONFIG_HOME\fR. If unset, \fCXDG_CONFIG_DIRS\fR defaults to \fC/etc/xdg\fR, and \fCXDG_CONFIG_HOME\fR defaults to \fC$HOME/.config\fR as per \fBXDG Base Directory Specification\fR (\fIhttps://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\fR). .IP "\(bu" 2 If \fCNIX_CONFIG\fR is set, its contents is treated as the contents of a configuration file. .LP The configuration files consist of \fCname = value\fR pairs, one per line. Other files can be included with a line like \fCinclude path\fR, where \fIpath\fR is interpreted relative to the current conf file and a missing file is an error unless \fC!include\fR is used instead. Comments start with a \fC#\fR character. Here is an example configuration file: .LP .EX keep-outputs = true # Nice for developers keep-derivations = true # Idem .EE .PP You can override settings on the command line using the \fC--option\fR flag, e.g. \fC--option keep-outputs false\fR. Every configuration setting also has a corresponding command line flag, e.g. \fC--max-jobs 16\fR; for Boolean settings, there are two flags to enable or disable the setting (e.g. \fC--keep-failed\fR and \fC--no-keep-failed\fR). .PP A configuration setting usually overrides any previous value. However, you can prefix the name of the setting by \fCextra-\fR to \fIappend\fR to the previous value. For instance, .LP .EX substituters = a b extra-substituters = c d .EE .PP defines the \fCsubstituters\fR setting to be \fCa b c d\fR. This is also available as a command line flag (e.g. \fC--extra-substituters\fR). .PP The following settings are currently available: .IP "\(bu" 2 \fB\fCaccept-flake-config\fR\fR (\fI#conf-accept-flake-config\fR) .IP Whether to accept nix configuration from a flake without prompting. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCaccess-tokens\fR\fR (\fI#conf-access-tokens\fR) .IP Access tokens used to access protected GitHub, GitLab, or other locations requiring token-based authentication. .IP Access tokens are specified as a string made up of space-separated \fChost=token\fR values. The specific token used is selected by matching the \fChost\fR portion against the \[u201C]host\[u201D] specification of the input. The actual use of the \fCtoken\fR value is determined by the type of resource being accessed: .RS .IP "\(bu" 2 Github: the token value is the OAUTH-TOKEN string obtained as the Personal Access Token from the Github server (see \fIhttps://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps\fR). .IP "\(bu" 2 Gitlab: the token value is either the OAuth2 token or the Personal Access Token (these are different types tokens for gitlab, see \fIhttps://docs.gitlab.com/12.10/ee/api/README.html#authentication\fR). The \fCtoken\fR value should be \fCtype:tokenstring\fR where \fCtype\fR is either \fCOAuth2\fR or \fCPAT\fR to indicate which type of token is being specified. .RE .IP Example \fC\(ti/.config/nix/nix.conf\fR: .LP .EX access-tokens = github.com=23ac...b289 gitlab.mycompany.com=PAT:A123Bp_Cd..EfG gitlab.com=OAuth2:1jklw3jk .EE .IP Example \fC\(ti/code/flake.nix\fR: .LP .EX input.foo = { type = \(dqgitlab\(dq; host = \(dqgitlab.mycompany.com\(dq; owner = \(dqmycompany\(dq; repo = \(dqpro\(dq; }; .EE .IP This example specifies three tokens, one each for accessing github.com, gitlab.mycompany.com, and sourceforge.net. .IP The \fCinput.foo\fR uses the \[u201C]gitlab\[u201D] fetcher, which might requires specifying the token type along with the token value. .IP \fBDefault:\fR \fC\(dq\(dq\fR .IP "\(bu" 2 \fB\fCallow-dirty\fR\fR (\fI#conf-allow-dirty\fR) .IP Whether to allow dirty Git/Mercurial trees. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCallow-import-from-derivation\fR\fR (\fI#conf-allow-import-from-derivation\fR) .IP By default, Nix allows you to \fCimport\fR from a derivation, allowing building at evaluation time. With this option set to false, Nix will throw an error when evaluating an expression that uses this feature, allowing users to ensure their evaluation will not require any builds to take place. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCallow-new-privileges\fR\fR (\fI#conf-allow-new-privileges\fR) .IP (Linux-specific.) By default, builders on Linux cannot acquire new privileges by calling setuid/setgid programs or programs that have file capabilities. For example, programs such as \fCsudo\fR or \fCping\fR will fail. (Note that in sandbox builds, no such programs are available unless you bind-mount them into the sandbox via the \fCsandbox-paths\fR option.) You can allow the use of such programs by enabling this option. This is impure and usually undesirable, but may be useful in certain scenarios (e.g. to spin up containers or set up userspace network interfaces in tests). .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCallow-symlinked-store\fR\fR (\fI#conf-allow-symlinked-store\fR) .IP If set to \fCtrue\fR, Nix will stop complaining if the store directory (typically /nix/store) contains symlink components. .IP This risks making some builds \[u201C]impure\[u201D] because builders sometimes \[u201C]canonicalise\[u201D] paths by resolving all symlink components. Problems occur if those builds are then deployed to machines where /nix/store resolves to a different location from that of the build machine. You can enable this setting if you are sure you\[u2019]re not going to do that. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCallow-unsafe-native-code-during-evaluation\fR\fR (\fI#conf-allow-unsafe-native-code-during-evaluation\fR) .IP Whether builtin functions that allow executing native code should be enabled. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCallowed-impure-host-deps\fR\fR (\fI#conf-allowed-impure-host-deps\fR) .IP Which prefixes to allow derivations to ask for access to (primarily for Darwin). .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCallowed-uris\fR\fR (\fI#conf-allowed-uris\fR) .IP A list of URI prefixes to which access is allowed in restricted evaluation mode. For example, when set to \fChttps://github.com/NixOS\fR, builtin functions such as \fCfetchGit\fR are allowed to access \fChttps://github.com/NixOS/patchelf.git\fR. .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCallowed-users\fR\fR (\fI#conf-allowed-users\fR) .IP A list of names of users (separated by whitespace) that are allowed to connect to the Nix daemon. As with the \fCtrusted-users\fR option, you can specify groups by prefixing them with \fC@\fR. Also, you can allow all users by specifying \fC*\fR. The default is \fC*\fR. .IP Note that trusted users are always allowed to connect. .IP \fBDefault:\fR \fC*\fR .IP "\(bu" 2 \fB\fCauto-optimise-store\fR\fR (\fI#conf-auto-optimise-store\fR) .IP If set to \fCtrue\fR, Nix automatically detects files in the store that have identical contents, and replaces them with hard links to a single copy. This saves disk space. If set to \fCfalse\fR (the default), you can still run \fCnix-store --optimise\fR to get rid of duplicate files. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCbash-prompt\fR\fR (\fI#conf-bash-prompt\fR) .IP The bash prompt (\fCPS1\fR) in \fCnix develop\fR shells. .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCbash-prompt-suffix\fR\fR (\fI#conf-bash-prompt-suffix\fR) .IP Suffix appended to the \fCPS1\fR environment variable in \fCnix develop\fR shells. .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCbuild-hook\fR\fR (\fI#conf-build-hook\fR) .IP The path of the helper program that executes builds to remote machines. .IP \fBDefault:\fR \fC/usr/libexec/nix/build-remote\fR .IP "\(bu" 2 \fB\fCbuild-poll-interval\fR\fR (\fI#conf-build-poll-interval\fR) .IP How often (in seconds) to poll for locks. .IP \fBDefault:\fR \fC5\fR .IP "\(bu" 2 \fB\fCbuild-users-group\fR\fR (\fI#conf-build-users-group\fR) .IP This options specifies the Unix group containing the Nix build user accounts. In multi-user Nix installations, builds should not be performed by the Nix account since that would allow users to arbitrarily modify the Nix store and database by supplying specially crafted builders; and they cannot be performed by the calling user since that would allow him/her to influence the build result. .IP Therefore, if this option is non-empty and specifies a valid group, builds will be performed under the user accounts that are a member of the group specified here (as listed in \fC/etc/group\fR). Those user accounts should not be used for any other purpose! .IP Nix will never run two builds under the same user account at the same time. This is to prevent an obvious security hole: a malicious user writing a Nix expression that modifies the build result of a legitimate Nix expression being built by another user. Therefore it is good to have as many Nix build user accounts as you can spare. (Remember: uids are cheap.) .IP The build users should have permission to create files in the Nix store, but not delete them. Therefore, \fC/nix/store\fR should be owned by the Nix account, its group should be the group specified here, and its mode should be \fC1775\fR. .IP If the build users group is empty, builds will be performed under the uid of the Nix process (that is, the uid of the caller if \fCNIX_REMOTE\fR is empty, the uid under which the Nix daemon runs if \fCNIX_REMOTE\fR is \fCdaemon\fR). Obviously, this should not be used in multi-user settings with untrusted users. .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCbuilders\fR\fR (\fI#conf-builders\fR) .IP A semicolon-separated list of build machines. For the exact format and examples, see \fBthe manual chapter on remote builds\fR (\fI../advanced-topics/distributed-builds.md\fR) .IP \fBDefault:\fR \fC@/dummy/machines\fR .IP "\(bu" 2 \fB\fCbuilders-use-substitutes\fR\fR (\fI#conf-builders-use-substitutes\fR) .IP If set to \fCtrue\fR, Nix will instruct remote build machines to use their own binary substitutes if available. In practical terms, this means that remote hosts will fetch as many build dependencies as possible from their own substitutes (e.g, from \fCcache.nixos.org\fR), instead of waiting for this host to upload them all. This can drastically reduce build times if the network connection between this computer and the remote build host is slow. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCcommit-lockfile-summary\fR\fR (\fI#conf-commit-lockfile-summary\fR) .IP The commit summary to use when committing changed flake lock files. If empty, the summary is generated based on the action performed. .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCcompress-build-log\fR\fR (\fI#conf-compress-build-log\fR) .IP If set to \fCtrue\fR (the default), build logs written to \fC/nix/var/log/nix/drvs\fR will be compressed on the fly using bzip2. Otherwise, they will not be compressed. .IP \fBDefault:\fR \fCtrue\fR .IP \fBDeprecated alias:\fR \fCbuild-compress-log\fR .IP "\(bu" 2 \fB\fCconnect-timeout\fR\fR (\fI#conf-connect-timeout\fR) .IP The timeout (in seconds) for establishing connections in the binary cache substituter. It corresponds to \fCcurl\fR’s \fC--connect-timeout\fR option. A value of 0 means no limit. .IP \fBDefault:\fR \fC0\fR .IP "\(bu" 2 \fB\fCcores\fR\fR (\fI#conf-cores\fR) .IP Sets the value of the \fCNIX_BUILD_CORES\fR environment variable in the invocation of builders. Builders can use this variable at their discretion to control the maximum amount of parallelism. For instance, in Nixpkgs, if the derivation attribute \fCenableParallelBuilding\fR is set to \fCtrue\fR, the builder passes the \fC-jN\fR flag to GNU Make. It can be overridden using the \fC--cores\fR command line switch and defaults to \fC1\fR. The value \fC0\fR means that the builder should use all available CPU cores in the system. .IP \fBDefault:\fR \fImachine-specific\fR \fBDeprecated alias:\fR \fCbuild-cores\fR .IP "\(bu" 2 \fB\fCdiff-hook\fR\fR (\fI#conf-diff-hook\fR) .IP Absolute path to an executable capable of diffing build results. The hook is executed if \fCrun-diff-hook\fR is true, and the output of a build is known to not be the same. This program is not executed to determine if two results are the same. .IP The diff hook is executed by the same user and group who ran the build. However, the diff hook does not have write access to the store path just built. .IP The diff hook program receives three parameters: .RS .IP "1. " A path to the previous build\[u2019]s results .IP "2. " A path to the current build\[u2019]s results .IP "3. " The path to the build\[u2019]s derivation .IP "4. " The path to the build\[u2019]s scratch directory. This directory will exist only if the build was run with \fC--keep-failed\fR. .RE .IP The stderr and stdout output from the diff hook will not be displayed to the user. Instead, it will print to the nix-daemon\[u2019]s log. .IP When using the Nix daemon, \fCdiff-hook\fR must be set in the \fCnix.conf\fR configuration file, and cannot be passed at the command line. .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCdownload-attempts\fR\fR (\fI#conf-download-attempts\fR) .IP How often Nix will attempt to download a file before giving up. .IP \fBDefault:\fR \fC5\fR .IP "\(bu" 2 \fB\fCenforce-determinism\fR\fR (\fI#conf-enforce-determinism\fR) .IP Whether to fail if repeated builds produce different output. See \fCrepeat\fR. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCeval-cache\fR\fR (\fI#conf-eval-cache\fR) .IP Whether to use the flake evaluation cache. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCexperimental-features\fR\fR (\fI#conf-experimental-features\fR) .IP Experimental Nix features to enable. .IP \fBDefault:\fR \fC3\fR .IP "\(bu" 2 \fB\fCextra-platforms\fR\fR (\fI#conf-extra-platforms\fR) .IP Platforms other than the native one which this machine is capable of building for. This can be useful for supporting additional architectures on compatible machines: i686-linux can be built on x86_64-linux machines (and the default for this setting reflects this); armv7 is backwards-compatible with armv6 and armv5tel; some aarch64 machines can also natively run 32-bit ARM code; and qemu-user may be used to support non-native platforms (though this may be slow and buggy). Most values for this are not enabled by default because build systems will often misdetect the target platform and generate incompatible code, so you may wish to cross-check the results of using this option against proper natively-built versions of your derivations. .IP \fBDefault:\fR \fImachine-specific\fR .IP "\(bu" 2 \fB\fCfallback\fR\fR (\fI#conf-fallback\fR) .IP If set to \fCtrue\fR, Nix will fall back to building from source if a binary substitute fails. This is equivalent to the \fC--fallback\fR flag. The default is \fCfalse\fR. .IP \fBDefault:\fR \fCfalse\fR .IP \fBDeprecated alias:\fR \fCbuild-fallback\fR .IP "\(bu" 2 \fB\fCfilter-syscalls\fR\fR (\fI#conf-filter-syscalls\fR) .IP Whether to prevent certain dangerous system calls, such as creation of setuid/setgid files or adding ACLs or extended attributes. Only disable this if you\[u2019]re aware of the security implications. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCflake-registry\fR\fR (\fI#conf-flake-registry\fR) .IP Path or URI of the global flake registry. .IP \fBDefault:\fR \fChttps://github.com/NixOS/flake-registry/raw/master/flake-registry.json\fR .IP "\(bu" 2 \fB\fCfsync-metadata\fR\fR (\fI#conf-fsync-metadata\fR) .IP If set to \fCtrue\fR, changes to the Nix store metadata (in \fC/nix/var/nix/db\fR) are synchronously flushed to disk. This improves robustness in case of system crashes, but reduces performance. The default is \fCtrue\fR. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCgc-reserved-space\fR\fR (\fI#conf-gc-reserved-space\fR) .IP Amount of reserved disk space for the garbage collector. .IP \fBDefault:\fR \fC8388608\fR .IP "\(bu" 2 \fB\fChashed-mirrors\fR\fR (\fI#conf-hashed-mirrors\fR) .IP A list of web servers used by \fCbuiltins.fetchurl\fR to obtain files by hash. The default is \fChttp://tarballs.nixos.org/\fR. Given a hash type \fIht\fR and a base-16 hash \fIh\fR, Nix will try to download the file from \fIhashed-mirror\fR/\fIht\fR/\fIh\fR. This allows files to be downloaded even if they have disappeared from their original URI. For example, given the default mirror \fChttp://tarballs.nixos.org/\fR, when building the derivation .LP .EX builtins.fetchurl { url = \(dqhttps://example.org/foo-1.2.3.tar.xz\(dq; sha256 = \(dq2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae\(dq; } .EE .IP Nix will attempt to download this file from \fChttp://tarballs.nixos.org/sha256/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae\fR first. If it is not available there, if will try the original URI. .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fChttp-connections\fR\fR (\fI#conf-http-connections\fR) .IP The maximum number of parallel TCP connections used to fetch files from binary caches and by other downloads. It defaults to 25. 0 means no limit. .IP \fBDefault:\fR \fC25\fR .IP \fBDeprecated alias:\fR \fCbinary-caches-parallel-connections\fR .IP "\(bu" 2 \fB\fChttp2\fR\fR (\fI#conf-http2\fR) .IP Whether to enable HTTP/2 support. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCignored-acls\fR\fR (\fI#conf-ignored-acls\fR) .IP A list of ACLs that should be ignored, normally Nix attempts to remove all ACLs from files and directories in the Nix store, but some ACLs like \fCsecurity.selinux\fR or \fCsystem.nfs4_acl\fR can\[u2019]t be removed even by root. Therefore it\[u2019]s best to just ignore them. .IP \fBDefault:\fR \fCsecurity.selinux system.nfs4_acl\fR .IP "\(bu" 2 \fB\fCimpersonate-linux-26\fR\fR (\fI#conf-impersonate-linux-26\fR) .IP Whether to impersonate a Linux 2.6 machine on newer kernels. .IP \fBDefault:\fR \fCfalse\fR .IP \fBDeprecated alias:\fR \fCbuild-impersonate-linux-26\fR .IP "\(bu" 2 \fB\fCkeep-build-log\fR\fR (\fI#conf-keep-build-log\fR) .IP If set to \fCtrue\fR (the default), Nix will write the build log of a derivation (i.e. the standard output and error of its builder) to the directory \fC/nix/var/log/nix/drvs\fR. The build log can be retrieved using the command \fCnix-store -l path\fR. .IP \fBDefault:\fR \fCtrue\fR .IP \fBDeprecated alias:\fR \fCbuild-keep-log\fR .IP "\(bu" 2 \fB\fCkeep-derivations\fR\fR (\fI#conf-keep-derivations\fR) .IP If \fCtrue\fR (default), the garbage collector will keep the derivations from which non-garbage store paths were built. If \fCfalse\fR, they will be deleted unless explicitly registered as a root (or reachable from other roots). .IP Keeping derivation around is useful for querying and traceability (e.g., it allows you to ask with what dependencies or options a store path was built), so by default this option is on. Turn it off to save a bit of disk space (or a lot if \fCkeep-outputs\fR is also turned on). .IP \fBDefault:\fR \fCtrue\fR .IP \fBDeprecated alias:\fR \fCgc-keep-derivations\fR .IP "\(bu" 2 \fB\fCkeep-env-derivations\fR\fR (\fI#conf-keep-env-derivations\fR) .IP If \fCfalse\fR (default), derivations are not stored in Nix user environments. That is, the derivations of any build-time-only dependencies may be garbage-collected. .IP If \fCtrue\fR, when you add a Nix derivation to a user environment, the path of the derivation is stored in the user environment. Thus, the derivation will not be garbage-collected until the user environment generation is deleted (\fCnix-env --delete-generations\fR). To prevent build-time-only dependencies from being collected, you should also turn on \fCkeep-outputs\fR. .IP The difference between this option and \fCkeep-derivations\fR is that this one is “sticky”: it applies to any user environment created while this option was enabled, while \fCkeep-derivations\fR only applies at the moment the garbage collector is run. .IP \fBDefault:\fR \fCfalse\fR .IP \fBDeprecated alias:\fR \fCenv-keep-derivations\fR .IP "\(bu" 2 \fB\fCkeep-failed\fR\fR (\fI#conf-keep-failed\fR) .IP Whether to keep temporary directories of failed builds. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCkeep-going\fR\fR (\fI#conf-keep-going\fR) .IP Whether to keep building derivations when another build fails. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCkeep-outputs\fR\fR (\fI#conf-keep-outputs\fR) .IP If \fCtrue\fR, the garbage collector will keep the outputs of non-garbage derivations. If \fCfalse\fR (default), outputs will be deleted unless they are GC roots themselves (or reachable from other roots). .IP In general, outputs must be registered as roots separately. However, even if the output of a derivation is registered as a root, the collector will still delete store paths that are used only at build time (e.g., the C compiler, or source tarballs downloaded from the network). To prevent it from doing so, set this option to \fCtrue\fR. .IP \fBDefault:\fR \fCfalse\fR .IP \fBDeprecated alias:\fR \fCgc-keep-outputs\fR .IP "\(bu" 2 \fB\fClog-lines\fR\fR (\fI#conf-log-lines\fR) .IP The number of lines of the tail of the log to show if a build fails. .IP \fBDefault:\fR \fC10\fR .IP "\(bu" 2 \fB\fCmax-build-log-size\fR\fR (\fI#conf-max-build-log-size\fR) .IP This option defines the maximum number of bytes that a builder can write to its stdout/stderr. If the builder exceeds this limit, it’s killed. A value of \fC0\fR (the default) means that there is no limit. .IP \fBDefault:\fR \fC0\fR .IP \fBDeprecated alias:\fR \fCbuild-max-log-size\fR .IP "\(bu" 2 \fB\fCmax-free\fR\fR (\fI#conf-max-free\fR) .IP When a garbage collection is triggered by the \fCmin-free\fR option, it stops as soon as \fCmax-free\fR bytes are available. The default is infinity (i.e. delete all garbage). .IP \fBDefault:\fR \fC-1\fR .IP "\(bu" 2 \fB\fCmax-jobs\fR\fR (\fI#conf-max-jobs\fR) .IP This option defines the maximum number of jobs that Nix will try to build in parallel. The default is \fC1\fR. The special value \fCauto\fR causes Nix to use the number of CPUs in your system. \fC0\fR is useful when using remote builders to prevent any local builds (except for \fCpreferLocalBuild\fR derivation attribute which executes locally regardless). It can be overridden using the \fC--max-jobs\fR (\fC-j\fR) command line switch. .IP \fBDefault:\fR \fC1\fR .IP \fBDeprecated alias:\fR \fCbuild-max-jobs\fR .IP "\(bu" 2 \fB\fCmax-silent-time\fR\fR (\fI#conf-max-silent-time\fR) .IP This option defines the maximum number of seconds that a builder can go without producing any data on standard output or standard error. This is useful (for instance in an automated build system) to catch builds that are stuck in an infinite loop, or to catch remote builds that are hanging due to network problems. It can be overridden using the \fC--max-silent-time\fR command line switch. .IP The value \fC0\fR means that there is no timeout. This is also the default. .IP \fBDefault:\fR \fC0\fR .IP \fBDeprecated alias:\fR \fCbuild-max-silent-time\fR .IP "\(bu" 2 \fB\fCmin-free\fR\fR (\fI#conf-min-free\fR) .IP When free disk space in \fC/nix/store\fR drops below \fCmin-free\fR during a build, Nix performs a garbage-collection until \fCmax-free\fR bytes are available or there is no more garbage. A value of \fC0\fR (the default) disables this feature. .IP \fBDefault:\fR \fC0\fR .IP "\(bu" 2 \fB\fCmin-free-check-interval\fR\fR (\fI#conf-min-free-check-interval\fR) .IP Number of seconds between checking free disk space. .IP \fBDefault:\fR \fC5\fR .IP "\(bu" 2 \fB\fCnar-buffer-size\fR\fR (\fI#conf-nar-buffer-size\fR) .IP Maximum size of NARs before spilling them to disk. .IP \fBDefault:\fR \fC33554432\fR .IP "\(bu" 2 \fB\fCnarinfo-cache-negative-ttl\fR\fR (\fI#conf-narinfo-cache-negative-ttl\fR) .IP The TTL in seconds for negative lookups. If a store path is queried from a substituter but was not found, there will be a negative lookup cached in the local disk cache database for the specified duration. .IP \fBDefault:\fR \fC3600\fR .IP "\(bu" 2 \fB\fCnarinfo-cache-positive-ttl\fR\fR (\fI#conf-narinfo-cache-positive-ttl\fR) .IP The TTL in seconds for positive lookups. If a store path is queried from a substituter, the result of the query will be cached in the local disk cache database including some of the NAR metadata. The default TTL is a month, setting a shorter TTL for positive lookups can be useful for binary caches that have frequent garbage collection, in which case having a more frequent cache invalidation would prevent trying to pull the path again and failing with a hash mismatch if the build isn\[u2019]t reproducible. .IP \fBDefault:\fR \fC2592000\fR .IP "\(bu" 2 \fB\fCnetrc-file\fR\fR (\fI#conf-netrc-file\fR) .IP If set to an absolute path to a \fCnetrc\fR file, Nix will use the HTTP authentication credentials in this file when trying to download from a remote host through HTTP or HTTPS. Defaults to \fC$NIX_CONF_DIR/netrc\fR. .IP The \fCnetrc\fR file consists of a list of accounts in the following format: .LP .EX machine my-machine login my-username password my-password .EE .IP For the exact syntax, see \fBthe \fCcurl\fR documentation\fR (\fIhttps://ec.haxx.se/usingcurl-netrc.html\fR). .RS .IP \fBNote\fR .IP This must be an absolute path, and \fC\(ti\fR is not resolved. For example, \fC\(ti/.netrc\fR won\[u2019]t resolve to your home directory\[u2019]s \fC.netrc\fR. .RE .IP \fBDefault:\fR \fC/dummy/netrc\fR .IP "\(bu" 2 \fB\fCnix-path\fR\fR (\fI#conf-nix-path\fR) .IP List of directories to be searched for \fC<...>\fR file references. .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCplugin-files\fR\fR (\fI#conf-plugin-files\fR) .IP A list of plugin files to be loaded by Nix. Each of these files will be dlopened by Nix, allowing them to affect execution through static initialization. In particular, these plugins may construct static instances of RegisterPrimOp to add new primops or constants to the expression language, RegisterStoreImplementation to add new store implementations, RegisterCommand to add new subcommands to the \fCnix\fR command, and RegisterSetting to add new nix config settings. See the constructors for those types for more details. .IP Warning! These APIs are inherently unstable and may change from release to release. .IP Since these files are loaded into the same address space as Nix itself, they must be DSOs compatible with the instance of Nix running at the time (i.e. compiled against the same headers, not linked to any incompatible libraries). They should not be linked to any Nix libs directly, as those will be available already at load time. .IP If an entry in the list is a directory, all files in the directory are loaded as plugins (non-recursively). .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCpost-build-hook\fR\fR (\fI#conf-post-build-hook\fR) .IP Optional. The path to a program to execute after each build. .IP This option is only settable in the global \fCnix.conf\fR, or on the command line by trusted users. .IP When using the nix-daemon, the daemon executes the hook as \fCroot\fR. If the nix-daemon is not involved, the hook runs as the user executing the nix-build. .RS .IP "\(bu" 2 The hook executes after an evaluation-time build. .IP "\(bu" 2 The hook does not execute on substituted paths. .IP "\(bu" 2 The hook\[u2019]s output always goes to the user\[u2019]s terminal. .IP "\(bu" 2 If the hook fails, the build succeeds but no further builds execute. .IP "\(bu" 2 The hook executes synchronously, and blocks other builds from progressing while it runs. .RE .IP The program executes with no arguments. The program\[u2019]s environment contains the following environment variables: .RS .IP "\(bu" 2 \fCDRV_PATH\fR The derivation for the built paths. .IP Example: \fC/nix/store/5nihn1a7pa8b25l9zafqaqibznlvvp3f-bash-4.4-p23.drv\fR .IP "\(bu" 2 \fCOUT_PATHS\fR Output paths of the built derivation, separated by a space character. .IP Example: \fC/nix/store/zf5lbh336mnzf1nlswdn11g4n2m8zh3g-bash-4.4-p23-dev /nix/store/rjxwxwv1fpn9wa2x5ssk5phzwlcv4mna-bash-4.4-p23-doc /nix/store/6bqvbzjkcp9695dq0dpl5y43nvy37pq1-bash-4.4-p23-info /nix/store/r7fng3kk3vlpdlh2idnrbn37vh4imlj2-bash-4.4-p23-man /nix/store/xfghy8ixrhz3kyy6p724iv3cxji088dx-bash-4.4-p23\fR. .RE .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCpre-build-hook\fR\fR (\fI#conf-pre-build-hook\fR) .IP If set, the path to a program that can set extra derivation-specific settings for this system. This is used for settings that can\[u2019]t be captured by the derivation model itself and are too variable between different versions of the same system to be hard-coded into nix. .IP The hook is passed the derivation path and, if sandboxes are enabled, the sandbox directory. It can then modify the sandbox and send a series of commands to modify various settings to stdout. The currently recognized commands are: .RS .IP "\(bu" 2 \fCextra-sandbox-paths\fR .br Pass a list of files and directories to be included in the sandbox for this build. One entry per line, terminated by an empty line. Entries have the same format as \fCsandbox-paths\fR. .RE .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCpreallocate-contents\fR\fR (\fI#conf-preallocate-contents\fR) .IP Whether to preallocate files when writing objects with known size. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCprint-missing\fR\fR (\fI#conf-print-missing\fR) .IP Whether to print what paths need to be built or downloaded. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCpure-eval\fR\fR (\fI#conf-pure-eval\fR) .IP Whether to restrict file system and network access to files specified by cryptographic hash. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCrepeat\fR\fR (\fI#conf-repeat\fR) .IP How many times to repeat builds to check whether they are deterministic. The default value is 0. If the value is non-zero, every build is repeated the specified number of times. If the contents of any of the runs differs from the previous ones and \fCenforce-determinism\fR is true, the build is rejected and the resulting store paths are not registered as “valid” in Nix’s database. .IP \fBDefault:\fR \fC0\fR .IP \fBDeprecated alias:\fR \fCbuild-repeat\fR .IP "\(bu" 2 \fB\fCrequire-sigs\fR\fR (\fI#conf-require-sigs\fR) .IP If set to \fCtrue\fR (the default), any non-content-addressed path added or copied to the Nix store (e.g. when substituting from a binary cache) must have a valid signature, that is, be signed using one of the keys listed in \fCtrusted-public-keys\fR or \fCsecret-key-files\fR. Set to \fCfalse\fR to disable signature checking. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCrestrict-eval\fR\fR (\fI#conf-restrict-eval\fR) .IP If set to \fCtrue\fR, the Nix evaluator will not allow access to any files outside of the Nix search path (as set via the \fCNIX_PATH\fR environment variable or the \fC-I\fR option), or to URIs outside of \fCallowed-uri\fR. The default is \fCfalse\fR. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCrun-diff-hook\fR\fR (\fI#conf-run-diff-hook\fR) .IP If true, enable the execution of the \fCdiff-hook\fR program. .IP When using the Nix daemon, \fCrun-diff-hook\fR must be set in the \fCnix.conf\fR configuration file, and cannot be passed at the command line. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCsandbox\fR\fR (\fI#conf-sandbox\fR) .IP If set to \fCtrue\fR, builds will be performed in a \fIsandboxed environment\fR, i.e., they’re isolated from the normal file system hierarchy and will only see their dependencies in the Nix store, the temporary build directory, private versions of \fC/proc\fR, \fC/dev\fR, \fC/dev/shm\fR and \fC/dev/pts\fR (on Linux), and the paths configured with the \fCsandbox-paths\fR option. This is useful to prevent undeclared dependencies on files in directories such as \fC/usr/bin\fR. In addition, on Linux, builds run in private PID, mount, network, IPC and UTS namespaces to isolate them from other processes in the system (except that fixed-output derivations do not run in private network namespace to ensure they can access the network). .IP Currently, sandboxing only work on Linux and macOS. The use of a sandbox requires that Nix is run as root (so you should use the “build users” feature to perform the actual builds under different users than root). .IP If this option is set to \fCrelaxed\fR, then fixed-output derivations and derivations that have the \fC__noChroot\fR attribute set to \fCtrue\fR do not run in sandboxes. .IP The default is \fCtrue\fR on Linux and \fCfalse\fR on all other platforms. .IP \fBDefault:\fR \fCtrue\fR .IP \fBDeprecated alias:\fR \fCbuild-use-chroot\fR, \fCbuild-use-sandbox\fR .IP "\(bu" 2 \fB\fCsandbox-build-dir\fR\fR (\fI#conf-sandbox-build-dir\fR) .IP The build directory inside the sandbox. .IP \fBDefault:\fR \fC/build\fR .IP "\(bu" 2 \fB\fCsandbox-dev-shm-size\fR\fR (\fI#conf-sandbox-dev-shm-size\fR) .IP This option determines the maximum size of the \fCtmpfs\fR filesystem mounted on \fC/dev/shm\fR in Linux sandboxes. For the format, see the description of the \fCsize\fR option of \fCtmpfs\fR in mount8. The default is \fC50%\fR. .IP \fBDefault:\fR \fC50%\fR .IP "\(bu" 2 \fB\fCsandbox-fallback\fR\fR (\fI#conf-sandbox-fallback\fR) .IP Whether to disable sandboxing when the kernel doesn\[u2019]t allow it. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCsandbox-paths\fR\fR (\fI#conf-sandbox-paths\fR) .IP A list of paths bind-mounted into Nix sandbox environments. You can use the syntax \fCtarget=source\fR to mount a path in a different location in the sandbox; for instance, \fC/bin=/nix-bin\fR will mount the path \fC/nix-bin\fR as \fC/bin\fR inside the sandbox. If \fIsource\fR is followed by \fC?\fR, then it is not an error if \fIsource\fR does not exist; for example, \fC/dev/nvidiactl?\fR specifies that \fC/dev/nvidiactl\fR will only be mounted in the sandbox if it exists in the host filesystem. .IP Depending on how Nix was built, the default value for this option may be empty or provide \fC/bin/sh\fR as a bind-mount of \fCbash\fR. .IP \fBDefault:\fR \fIempty\fR .IP \fBDeprecated alias:\fR \fCbuild-chroot-dirs\fR, \fCbuild-sandbox-paths\fR .IP "\(bu" 2 \fB\fCsecret-key-files\fR\fR (\fI#conf-secret-key-files\fR) .IP A whitespace-separated list of files containing secret (private) keys. These are used to sign locally-built paths. They can be generated using \fCnix-store --generate-binary-cache-key\fR. The corresponding public key can be distributed to other users, who can add it to \fCtrusted-public-keys\fR in their \fCnix.conf\fR. .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCshow-trace\fR\fR (\fI#conf-show-trace\fR) .IP Whether Nix should print out a stack trace in case of Nix expression evaluation errors. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCstalled-download-timeout\fR\fR (\fI#conf-stalled-download-timeout\fR) .IP The timeout (in seconds) for receiving data from servers during download. Nix cancels idle downloads after this timeout\[u2019]s duration. .IP \fBDefault:\fR \fC300\fR .IP "\(bu" 2 \fB\fCstore\fR\fR (\fI#conf-store\fR) .IP The default Nix store to use. .IP \fBDefault:\fR \fCauto\fR .IP "\(bu" 2 \fB\fCsubstitute\fR\fR (\fI#conf-substitute\fR) .IP If set to \fCtrue\fR (default), Nix will use binary substitutes if available. This option can be disabled to force building from source. .IP \fBDefault:\fR \fCtrue\fR .IP \fBDeprecated alias:\fR \fCbuild-use-substitutes\fR .IP "\(bu" 2 \fB\fCsubstituters\fR\fR (\fI#conf-substituters\fR) .IP A list of URLs of substituters, separated by whitespace. Substituters are tried based on their Priority value, which each substituter can set independently. Lower value means higher priority. The default is \fChttps://cache.nixos.org\fR, with a Priority of 40. .IP \fBDefault:\fR \fChttps://cache.nixos.org/\fR .IP \fBDeprecated alias:\fR \fCbinary-caches\fR .IP "\(bu" 2 \fB\fCsync-before-registering\fR\fR (\fI#conf-sync-before-registering\fR) .IP Whether to call \fCsync()\fR before registering a path as valid. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCsystem\fR\fR (\fI#conf-system\fR) .IP This option specifies the canonical Nix system name of the current installation, such as \fCi686-linux\fR or \fCx86_64-darwin\fR. Nix can only build derivations whose \fCsystem\fR attribute equals the value specified here. In general, it never makes sense to modify this value from its default, since you can use it to ‘lie’ about the platform you are building on (e.g., perform a Mac OS build on a Linux machine; the result would obviously be wrong). It only makes sense if the Nix binaries can run on multiple platforms, e.g., ‘universal binaries’ that run on \fCx86_64-linux\fR and \fCi686-linux\fR. .IP It defaults to the canonical Nix system name detected by \fCconfigure\fR at build time. .IP \fBDefault:\fR \fCx86_64-linux\fR .IP "\(bu" 2 \fB\fCsystem-features\fR\fR (\fI#conf-system-features\fR) .IP A set of system “features” supported by this machine, e.g. \fCkvm\fR. Derivations can express a dependency on such features through the derivation attribute \fCrequiredSystemFeatures\fR. For example, the attribute .LP .EX requiredSystemFeatures = [ \(dqkvm\(dq ]; .EE .IP ensures that the derivation can only be built on a machine with the \fCkvm\fR feature. .IP This setting by default includes \fCkvm\fR if \fC/dev/kvm\fR is accessible, and the pseudo-features \fCnixos-test\fR, \fCbenchmark\fR and \fCbig-parallel\fR that are used in Nixpkgs to route builds to specific machines. .IP \fBDefault:\fR \fImachine-specific\fR .IP "\(bu" 2 \fB\fCtarball-ttl\fR\fR (\fI#conf-tarball-ttl\fR) .IP The number of seconds a downloaded tarball is considered fresh. If the cached tarball is stale, Nix will check whether it is still up to date using the ETag header. Nix will download a new version if the ETag header is unsupported, or the cached ETag doesn\[u2019]t match. .IP Setting the TTL to \fC0\fR forces Nix to always check if the tarball is up to date. .IP Nix caches tarballs in \fC$XDG_CACHE_HOME/nix/tarballs\fR. .IP Files fetched via \fCNIX_PATH\fR, \fCfetchGit\fR, \fCfetchMercurial\fR, \fCfetchTarball\fR, and \fCfetchurl\fR respect this TTL. .IP \fBDefault:\fR \fC3600\fR .IP "\(bu" 2 \fB\fCtimeout\fR\fR (\fI#conf-timeout\fR) .IP This option defines the maximum number of seconds that a builder can run. This is useful (for instance in an automated build system) to catch builds that are stuck in an infinite loop but keep writing to their standard output or standard error. It can be overridden using the \fC--timeout\fR command line switch. .IP The value \fC0\fR means that there is no timeout. This is also the default. .IP \fBDefault:\fR \fC0\fR .IP \fBDeprecated alias:\fR \fCbuild-timeout\fR .IP "\(bu" 2 \fB\fCtrace-function-calls\fR\fR (\fI#conf-trace-function-calls\fR) .IP If set to \fCtrue\fR, the Nix evaluator will trace every function call. Nix will print a log message at the \[u201C]vomit\[u201D] level for every function entrance and function exit. .LP .EX function-trace entered undefined position at 1565795816999559622 function-trace exited undefined position at 1565795816999581277 function-trace entered /nix/store/.../example.nix:226:41 at 1565795253249935150 function-trace exited /nix/store/.../example.nix:226:41 at 1565795253249941684 .EE .IP The \fCundefined position\fR means the function call is a builtin. .IP Use the \fCcontrib/stack-collapse.py\fR script distributed with the Nix source code to convert the trace logs in to a format suitable for \fCflamegraph.pl\fR. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCtrusted-public-keys\fR\fR (\fI#conf-trusted-public-keys\fR) .IP A whitespace-separated list of public keys. When paths are copied from another Nix store (such as a binary cache), they must be signed with one of these keys. For example: \fCcache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs=\fR. .IP \fBDefault:\fR \fCcache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=\fR .IP \fBDeprecated alias:\fR \fCbinary-cache-public-keys\fR .IP "\(bu" 2 \fB\fCtrusted-substituters\fR\fR (\fI#conf-trusted-substituters\fR) .IP A list of URLs of substituters, separated by whitespace. These are not used by default, but can be enabled by users of the Nix daemon by specifying \fC--option substituters urls\fR on the command line. Unprivileged users are only allowed to pass a subset of the URLs listed in \fCsubstituters\fR and \fCtrusted-substituters\fR. .IP \fBDefault:\fR \fIempty\fR .IP \fBDeprecated alias:\fR \fCtrusted-binary-caches\fR .IP "\(bu" 2 \fB\fCtrusted-users\fR\fR (\fI#conf-trusted-users\fR) .IP A list of names of users (separated by whitespace) that have additional rights when connecting to the Nix daemon, such as the ability to specify additional binary caches, or to import unsigned NARs. You can also specify groups by prefixing them with \fC@\fR; for instance, \fC@wheel\fR means all users in the \fCwheel\fR group. The default is \fCroot\fR. .RS .IP \fBWarning\fR .IP Adding a user to \fCtrusted-users\fR is essentially equivalent to giving that user root access to the system. For example, the user can set \fCsandbox-paths\fR and thereby obtain read access to directories that are otherwise inacessible to them. .RE .IP \fBDefault:\fR \fCroot\fR .IP "\(bu" 2 \fB\fCuse-case-hack\fR\fR (\fI#conf-use-case-hack\fR) .IP Whether to enable a Darwin-specific hack for dealing with file name collisions. .IP \fBDefault:\fR \fCfalse\fR .IP "\(bu" 2 \fB\fCuse-registries\fR\fR (\fI#conf-use-registries\fR) .IP Whether to use flake registries to resolve flake references. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCuse-sqlite-wal\fR\fR (\fI#conf-use-sqlite-wal\fR) .IP Whether SQLite should use WAL mode. .IP \fBDefault:\fR \fCtrue\fR .IP "\(bu" 2 \fB\fCuser-agent-suffix\fR\fR (\fI#conf-user-agent-suffix\fR) .IP String appended to the user agent in HTTP requests. .IP \fBDefault:\fR \fIempty\fR .IP "\(bu" 2 \fB\fCwarn-dirty\fR\fR (\fI#conf-warn-dirty\fR) .IP Whether to warn about dirty Git/Mercurial trees. .IP \fBDefault:\fR \fCtrue\fR