guix package command is the tool that allows users to
install, upgrade, and remove packages, as well as rolling back to
previous configurations. It operates only on the user’s own profile,
and works with normal user privileges (see Features). Its syntax
guix package options
Primarily, options specifies the operations to be performed during the transaction. Upon completion, a new profile is created, but previous generations of the profile remain available, should the user want to roll back.
For each user, a symlink to the user’s default profile is automatically
created in $HOME/.guix-profile. This symlink always points to the
current generation of the user’s default profile. Thus, users can add
$HOME/.guix-profile/bin to their
variable, and so on.
In a multi-user setup, user profiles must be stored in a place
registered as a garbage-collector root, which
$HOME/.guix-profile points to (see Invoking guix gc). That
directory is normally
localstatedir is the value passed to
--localstatedir, and user is the user name. It must be
root, with user as the owner. When it does not
exist, or is not owned by user,
guix package emits an
error about it.
The options can be among the following:
package may specify either a simple package name, such as
guile, or a package name followed by a hyphen and version number,
guile-1.8.8. If no version number is specified, the
newest available version will be selected. In addition, package
may contain a colon, followed by the name of one of the outputs of the
package, as in
(see Packages with Multiple Outputs).
Sometimes packages have propagated inputs: these are dependencies that automatically get installed along with the required package.
An example is the GNU MPC library: its C header files refer to those of the GNU MPFR library, which in turn refer to those of the GMP library. Thus, when installing MPC, the MPFR and GMP libraries also get installed in the profile; removing MPC also removes MPFR and GMP—unless they had also been explicitly installed independently.
Besides, packages sometimes rely on the definition of environment
variables for their search paths (see explanation of
--search-paths below). Any missing or possibly incorrect
environment variable definitions are reported here.
Finally, when installing a GNU package, the tool reports the availability of a newer upstream version. In the future, it may provide the option of installing directly from the upstream version, even if that version is not yet in the distribution.
Install the package exp evaluates to.
exp must be a Scheme expression that evaluates to a
<package> object. This option is notably useful to disambiguate
between same-named variants of a package, with expressions such as
(@ (gnu packages base) guile-final).
Note that this option installs the first output of the specified package, which may be insufficient when needing a specific output of a multiple-output package.
--install, package may specify a version number
and/or output name in addition to the package name. For instance,
-r glibc:debug would remove the
debug output of
Upgrade all the installed packages. When regexp is specified, upgrade only installed packages whose name matches regexp.
Note that this upgrades package to the latest version of packages found
in the distribution currently installed. To update your distribution,
you should regularly run
guix pull (see Invoking guix pull).
Roll back to the previous generation of the profile—i.e., undo the last transaction.
When combined with options such as
--install, roll back occurs
before any other actions.
When rolling back from the first generation that actually contains installed packages, the profile is made to point to the zeroth generation, which contains no files apart from its own meta-data.
Installing, removing, or upgrading packages from a generation that has been rolled back to overwrites previous future generations. Thus, the history of a profile’s generations is always linear.
Report environment variable definitions, in Bash syntax, that may be needed in order to use the set of installed packages. These environment variables are used to specify search paths for files used by some of the installed packages.
For example, GCC needs the
environment variables to be defined so it can look for headers and
libraries in the user’s profile (see Environment Variables in Using the GNU Compiler Collection (GCC)). If GCC and, say, the C
library are installed in the profile, then
suggest setting these variables to
Use profile instead of the user’s default profile.
Show what would be done without actually doing it.
When substituting a pre-built binary fails, fall back to building packages locally.
Do not use substitutes for build products. That is, always build things locally instead of allowing downloads of pre-built binaries.
Same as for
guix build (see Invoking guix build).
Produce verbose output. In particular, emit the environment’s build log on the standard error port.
Use the bootstrap Guile to build the profile. This option is only useful to distribution developers.
In addition to these actions
guix package supports the
following options to query the current state of a profile, or the
availability of packages:
List the available packages whose synopsis or description matches
regexp. Print all the meta-data of matching packages in
recutils format (see GNU recutils databases in GNU recutils manual).
This allows specific fields to be extracted using the
command, for instance:
$ guix package -s malloc | recsel -p name,version name: glibc version: 2.17 name: libgc version: 7.2alpha6
List the currently installed packages in the specified profile, with the most recently installed packages shown last. When regexp is specified, list only installed packages whose name matches regexp.
For each installed package, print the following items, separated by
tabs: the package name, its version string, the part of the package that
is installed (for instance,
out for the default output,
include for its headers, etc.), and the path of this package in
List packages currently available in the software distribution (see GNU Distribution). When regexp is specified, list only installed packages whose name matches regexp.
For each package, print the following items separated by tabs: its name, its version string, the parts of the package (see Packages with Multiple Outputs), and the source location of its definition.
Return a list of generations along with their creation dates; for each generation, show the installed packages, with the most recently installed packages shown last. Note that the zeroth generation is never shown.
For each installed package, print the following items, separated by tabs: the name of a package, its version string, the part of the package that is installed (see Packages with Multiple Outputs), and the location of this package in the store.
When pattern is used, the command returns only matching generations. Valid patterns include:
--list-generations=1returns the first one.
--list-generations=1,8,2 outputs three generations in the
specified order. Neither spaces nor trailing commas are allowed.
--list-generations=2..9prints the specified generations and everything in between. Note that the start of a range must be lesser than its end.
It is also possible to omit the endpoint. For example,
--list-generations=2.., returns all generations starting from the
--list-generations=20dlists generations that are up to 20 days old.
When pattern is omitted, delete all generations except the current one.
This command accepts the same patterns as --list-generations.
When pattern is specified, delete the matching generations. When
pattern specifies a duration, generations older than the
specified duration match. For instance,
deletes generations that are more than one month old.
If the current generation matches, it is deleted atomically—i.e., by switching to the previous available generation. Note that the zeroth generation is never deleted.
Note that deleting generations prevents roll-back to them. Consequently, this command must be used with care.