Common environment variablesMost Nix commands interpret the following environment variables:NIX_PATHA colon-separated list of directories used to look up Nix
expressions enclosed in angle brackets (i.e.,
<path>). For
instance, the value
/home/eelco/Dev:/etc/nixos
will cause Nix to look for paths relative to
/home/eelco/Dev and
/etc/nixos, in that order. It is also
possible to match paths against a prefix. For example, the value
nixpkgs=/home/eelco/Dev/nixpkgs-branch:/etc/nixos
will cause Nix to search for
<nixpkgs/path> in
/home/eelco/Dev/nixpkgs-branch/path
and
/etc/nixos/nixpkgs/path.
The search path can be extended using the
option, which takes precedence over
NIX_PATH.NIX_IGNORE_SYMLINK_STORENormally, the Nix store directory (typically
/nix/store) is not allowed to contain any
symlink components. This is to prevent “impure” builds. Builders
sometimes “canonicalise” paths by resolving all symlink components.
Thus, builds on different machines (with
/nix/store resolving to different locations)
could yield different results. This is generally not a problem,
except when builds are deployed to machines where
/nix/store resolves differently. If you are
sure that you’re not going to do that, you can set
NIX_IGNORE_SYMLINK_STORE to 1.Note that if you’re symlinking the Nix store so that you can
put it on another file system than the root file system, on Linux
you’re better off using bind mount points, e.g.,
$ mkdir /nix
$ mount -o bind /mnt/otherdisk/nix /nix
Consult the mount8 manual page for details.NIX_STORE_DIROverrides the location of the Nix store (default
prefix/store).NIX_DATA_DIROverrides the location of the Nix static data
directory (default
prefix/share).NIX_LOG_DIROverrides the location of the Nix log directory
(default prefix/log/nix).NIX_STATE_DIROverrides the location of the Nix state directory
(default prefix/var/nix).NIX_DB_DIROverrides the location of the Nix database (default
$NIX_STATE_DIR/db, i.e.,
prefix/var/nix/db).NIX_CONF_DIROverrides the location of the Nix configuration
directory (default
prefix/etc/nix).NIX_LOG_TYPEEquivalent to the
option.TMPDIRUse the specified directory to store temporary
files. In particular, this includes temporary build directories;
these can take up substantial amounts of disk space. The default is
/tmp.NIX_BUILD_HOOKSpecifies the location of the build hook,
which is a program (typically some script) that Nix will call
whenever it wants to build a derivation. This is used to implement
distributed builds (see ).NIX_REMOTEThis variable should be set to
daemon if you want to use the Nix daemon to
executed Nix operations, which is necessary in multi-user Nix installations.
Otherwise, it should be left unset.NIX_OTHER_STORESThis variable contains the paths of remote Nix
installations from whichs paths can be copied, separated by colons.
See for details. Each path should be the
/nix directory of a remote Nix installation
(i.e., not the /nix/store directory). The
paths are subject to globbing, so you can set it so something like
/var/run/nix/remote-stores/*/nix and mount
multiple remote filesystems in
/var/run/nix/remote-stores.Note that if you’re building through the Nix daemon, the only setting for
this variable that matters is the one that the
nix-daemon process uses. So if you want to
change it, you have to restart the daemon.GC_INITIAL_HEAP_SIZEIf Nix has been configured to use the Boehm garbage
collector, this variable sets the initial size of the heap in bytes.
It defaults to 384 MiB. Setting it to a low value reduces memory
consumption, but will increase runtime due to the overhead of
garbage collection.