Nix 2.28.2
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
local-store

R"( <strong>Store URL format</strong>: <tt>local</tt>, <em>root</em> This store type accesses a Nix store in the local filesystem directly (i.e. not via the Nix daemon). <em>root</em> is an absolute path that is prefixed to other directories such as the Nix store directory. The store pseudo-URL <tt>local</tt> denotes a store that uses <tt>/</tt> as its root directory. A store that uses a <em>root</em> other than <tt>/</tt> is called a <em>chroot store</em>. With such stores, the store directory is "logically" still <tt>/nix/store</tt>, so programs stored in them can only be built and executed by <tt>chroot</tt>-ing into <em>root</em>. Chroot stores only support building and running on Linux when <a href="https://man7.org/linux/man-pages/man7/mount_namespaces.7.html" ><tt>mount namespaces</tt></a> and <a href="https://man7.org/linux/man-pages/man7/user_namespaces.7.html" ><tt>user namespaces</tt></a> are enabled. For example, the following uses <tt>/tmp/root</tt> as the chroot environment to build or download <tt>nixpkgs\#hello</tt> and then execute it: @icode{console} # nix run --store /tmp/root nixpkgs#hello Hello, world! @endicode Here, the "physical" store location is <tt>/tmp/root/nix/store</tt>, and Nix's store metadata is in <tt>/tmp/root/nix/var/nix/db</tt>. It is also possible, but not recommended, to change the "logical" location of the Nix store from its default of <tt>/nix/store</tt>. This makes it impossible to use default substituters such as <tt>https://cache.nixos.org/</tt>, and thus you may have to build everything locally. Here is an example: @icode{console} # nix build --store 'local?store=/tmp/my-nix/store&state=/tmp/my-nix/state&log=/tmp/my-nix/log' nixpkgs#hello @endicode )"