Local Store - Nix 2.34.9 Reference Manual
Local Store
Store URL format: local, root
This store type accesses a Nix store in the local filesystem directly
(i.e. not via the Nix daemon). root is an absolute path that is
prefixed to other directories such as the Nix store directory. The
store pseudo-URL local denotes a store that uses / as its root
directory.
A store that uses a root other than / is called a chroot
store. With such stores, the store directory is "logically" still /nix/store, so programs stored in them can only be built and
executed by chroot-ing into root. Chroot stores only support
building and running on Linux when mount namespaces and user namespaces are
enabled.
For example, the following uses /tmp/root as the chroot environment
to build or download nixpkgs#hello and then execute it:
# nix run --store /tmp/root nixpkgs#hello
Hello, world! Here, the "physical" store location is /tmp/root/nix/store, and
Nix's store metadata is in /tmp/root/nix/var/nix/db.
It is also possible, but not recommended, to change the "logical"
location of the Nix store from its default of /nix/store. This makes
it impossible to use default substituters such as https://cache.nixos.org/, and thus you may have to build everything
locally. Here is an example:
# nix build --store 'local?store=/tmp/my-nix/store&state=/tmp/my-nix/state&log=/tmp/my-nix/log' nixpkgs#hello Settings
build-dirThe directory on the host, in which derivations' temporary build directories are created. If not set, Nix will use thebuildssubdirectory of its configured state directory. Note that builds are often performed by the Nix daemon, so itsbuild-dirapplies. Nix will create this directory automatically with suitable permissions if it does not exist. Otherwise its permissions must allow all users to traverse the directory (i.e. it must haveo+xset, in unix parlance) for non-sandboxed builds to work correctly. This is also the location where--keep-failedleaves its files. If Nix runs without sandbox, or if the platform does not support sandboxing with bind mounts (e.g. macOS), then thebuilder's environment will contain this directory, instead of the virtual locationsandbox-build-dir.
Warning build-dir must not be set to a world-writable directory.
Placing temporary build directories in a world-writable place allows other users to access or modify build data that is currently in use.
This alone is merely an impurity, but combined with another factor this has allowed malicious derivations to escape the build sandbox.
See also the global build-dir setting. Default: ``
ignore-gc-delete-failure
Warning This setting is part of an experimental feature.
To change this setting, make sure the local-overlay-store experimental feature is enabled.
For example, include the following in nix.conf:
extra-experimental-features = local-overlay-store
ignore-gc-delete-failure = ...
Whether to ignore failures when deleting items with the garbage collector.
Normally the garbage collector will fail with an error if the nix daemon cannot delete a file, with this setting such errors will only be printed as warnings. Default: false
logdirectory where Nix stores log files. Default:/nix/var/log/nixpath-info-cache-sizeSize of the in-memory store path metadata cache. Default:65536priorityPriority of this store when used as a substituter. A lower value means a higher priority. Default:0read-onlyAllow this store to be opened when its database is on a read-only filesystem. Normally Nix attempts to open the store database in read-write mode, even for querying (when write access is not needed), causing it to fail if the database is on a read-only filesystem. Enable read-only mode to disable locking and open the SQLite database with theimmutableparameter set.
Warning Do not use this unless the filesystem is read-only. Using it when the filesystem is writable can cause incorrect query results or corruption errors if the database is changed by another process. While the filesystem the database resides on might appear to be read-only, consider whether another user or system might have write access to it.
Default: false
realPhysical path of the Nix store. Default:/nix/storerequire-sigsWhether store paths copied into this store should have a trusted signature. Default:truerootDirectory prefixed to all other paths. Default: ``stateDirectory where Nix stores state. Default:/dummystoreLogical location of the Nix store, usually/nix/store. Note that you can only copy store paths between stores if they have the samestoresetting. Default:/nix/storesystem-featuresOptional system features available on the system this store uses to build derivations. Example:"kvm"Default: machine-specifictrustedWhether paths from this store can be used as substitutes even if they are not signed by a key listed in thetrusted-public-keyssetting. Default:falseuse-roots-daemon
Warning This setting is part of an experimental feature.
To change this setting, make sure the local-overlay-store experimental feature is enabled.
For example, include the following in nix.conf:
extra-experimental-features = local-overlay-store
use-roots-daemon = ...
Whether to request garbage collector roots from an external daemon.
When enabled, the garbage collector connects to a Unix domain socket
at <state-dir>/gc-roots-socket/socket to discover additional roots
that should not be collected. This is useful when the Nix daemon runs
without root privileges and cannot scan /proc for runtime roots.
The daemon can be started with nix store roots-daemon. Default: false
want-mass-queryWhether this store can be queried efficiently for path validity when used as a substituter. Default:false