Conceptually, the store is the place where derivations that have been built successfully are stored—by default, /gnu/store. Sub-directories in the store are referred to as store items or sometimes store paths. The store has an associated database that contains information such as the store paths referred to by each store path, and the list of valid store items—results of successful builds. This database resides in localstatedir/guix/db, where localstatedir is the state directory specified via --localstatedir at configure time, usually /var.
The store is always accessed by the daemon on behalf of its clients (see 调用guix-daemon). To manipulate the store, clients connect to the daemon over a Unix-domain socket, send requests to it, and read the result—these are remote procedure calls, or RPCs.
注: Users must never modify files under /gnu/store directly. This would lead to inconsistencies and break the immutability assumptions of Guix’s functional model (see 介绍).
guix gc --verify, for information on how to check the integrity of the store and attempt recovery from accidental modifications.
(guix store) module provides procedures to connect to the daemon,
and to perform RPCs. These are described below. By default,
open-connection, and thus all the
guix commands, connect to
the local daemon or to the URI specified by the
When set, the value of this variable should be a file name or a URI designating the daemon endpoint. When it is a file name, it denotes a Unix-domain socket to connect to. In addition to file names, the supported URI schemes are:
These are for Unix-domain sockets.
file:///var/guix/daemon-socket/socket is equivalent to
These URIs denote connections over TCP/IP, without encryption nor authentication of the remote host. The URI must specify the host name and optionally a port number (by default port 44146 is used):
This setup is suitable on local networks, such as clusters, where only
trusted nodes may connect to the build daemon at
The --listen option of
guix-daemon can be used to
instruct it to listen for TCP connections (see --listen).
These URIs allow you to connect to a remote daemon over SSH. This feature
requires Guile-SSH (see 需求) and a working
PATH on the destination machine. It supports public key and
GSSAPI authentication. A typical URL might look like this:
guix copy, the usual OpenSSH client configuration files are
honored (see 调用guix copy).
Additional URI schemes may be supported in the future.
注: The ability to connect to remote build daemons is considered experimental as of 26744bc. Please get in touch with us to share any problems or suggestions you may have (see 贡献).
Connect to the daemon over the Unix-domain socket at uri (a string). When reserve-space? is true, instruct it to reserve a little bit of extra space on the file system so that the garbage collector can still operate should the disk become full. Return a server object.
file defaults to
%default-socket-path, which is the normal
location given the options that were passed to
Close the connection to server.
This variable is bound to a SRFI-39 parameter, which refers to the port where build and error logs sent by the daemon should be written.
Procedures that make RPCs all take a server object as their first argument.
#t when path designates a valid store item and
otherwise (an invalid item may exist on disk but still be invalid, for
instance because it is the result of an aborted or failed build).
&store-protocol-error condition is raised if path is not
prefixed by the store directory (/gnu/store).
Add text under file name in the store, and return its store path. references is the list of store paths referred to by the resulting store path.
.drv file names, or derivation/output pairs, using the specified
(build-mode normal) by default.
Note that the
(guix monads) module provides a monad as well as
monadic versions of the above procedures, with the goal of making it more
convenient to work with code that accesses the store (see 仓库monad).
This section is currently incomplete.