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
-
directory where Nix will store log files.
Default:
/nix/var/log/nix
-
Size of the in-memory store path metadata cache.
Default:
65536
-
Priority of this store when used as a substituter. A lower value means a higher priority.
Default:
0
-
Allow this store to be opened when its database is on a read-only filesystem.
Normally Nix will attempt 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 the
immutable
parameter 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
-
Physical path of the Nix store.
Default:
/nix/store
-
Whether store paths copied into this store should have a trusted signature.
Default:
true
-
Directory prefixed to all other paths.
Default: ``
-
Directory where Nix will store state.
Default:
/dummy
-
Logical location of the Nix store, usually
/nix/store
. Note that you can only copy store paths between stores if they have the samestore
setting.Default:
/nix/store
-
Optional system features available on the system this store uses to build derivations.
Example:
"kvm"
Default: machine-specific
-
Whether paths from this store can be used as substitutes even if they are not signed by a key listed in the
trusted-public-keys
setting.Default:
false
-
Whether this store can be queried efficiently for path validity when used as a substituter.
Default:
false