Once you have written a home environment declaration (see Declaring the Home Environment, it can be instantiated using the
guix home command. The synopsis is:
guix home options… action file
file must be the name of a file containing a
home-environment declaration. action specifies how the
home environment is instantiated, but there are few auxiliary actions
which don’t instantiate it. Currently the following values are
Display available home service type definitions that match the given regular expressions, sorted by relevance:
$ guix home search shell name: home-shell-profile location: gnu/home/services/shells.scm:100:2 extends: home-files description: Create `~/.profile', which is used for environment initialization of POSIX compliant login shells. + This service type can be extended with a list of file-like objects. relevance: 6 name: home-fish location: gnu/home/services/shells.scm:640:2 extends: home-files home-profile description: Install and configure Fish, the friendly interactive shell. relevance: 3 name: home-zsh location: gnu/home/services/shells.scm:290:2 extends: home-files home-profile description: Install and configure Zsh. relevance: 1 name: home-bash location: gnu/home/services/shells.scm:508:2 extends: home-files home-profile description: Install and configure GNU Bash. relevance: 1 …
guix search, the result is written in
recutils format, which makes it easy to filter the output
(see GNU recutils databases in GNU recutils manual).
Spawn a shell in an isolated environment—a container—containing your home as specified by file.
For example, this is how you would start an interactive shell in a container with your home:
guix home container config.scm
This is a throw-away container where you can lightheartedly fiddle with files; any changes made within the container, any process started—all this disappears as soon as you exit that shell.
guix shell, several options control that container:
Enable networking within the container (it is disabled by default).
guix shell, make directory source of the host
system available as target inside the container—read-only if you
pass --expose, and writable if you pass --share
(see --expose and --share).
Additionally, you can run a command in that container, instead of spawning an interactive shell. For instance, here is how you would check which Shepherd services are started in a throw-away home container:
guix home container config.scm -- herd status
The command to run in the container must come after
Edit or view the definition of the given Home service types.
For example, the command below opens your editor, as specified by the
EDITOR environment variable, on the definition of the
home-mcron service type:
guix home edit home-mcron
Build the home environment described in file, and switch to it.
Switching means that the activation script will be evaluated and (in
basic scenario) symlinks to configuration files generated from
home-environment declaration will be created in ~. If the
file with the same path already exists in home folder it will be moved
to ~/timestamp-guix-home-legacy-configs-backup, where timestamp
is a current UNIX epoch time.
Note: It is highly recommended to run
guix pullonce before you run
guix home reconfigurefor the first time (see Invoking guix pull).
This effects all the configuration specified in file. The command
starts Shepherd services specified in file that are not currently
running; if a service is currently running, this command will arrange
for it to be upgraded the next time it is stopped (e.g. by
stop service or
herd restart service).
This command creates a new generation whose number is one greater than
the current generation (as reported by
list-generations). If that generation already exists, it will be
overwritten. This behavior mirrors that of
(see Invoking guix package).
Upon completion, the new home is deployed under ~/.guix-home. This directory contains provenance meta-data: the list of channels in use (see Channels) and file itself, when available. You can view the provenance information by running:
guix home describe
This information is useful should you later want to inspect how this particular generation was built. In fact, assuming file is self-contained, you can later rebuild generation n of your home environment with:
guix time-machine \ -C /var/guix/profiles/per-user/USER/guix-home-n-link/channels.scm -- \ home reconfigure \ /var/guix/profiles/per-user/USER/guix-home-n-link/configuration.scm
You can think of it as some sort of built-in version control! Your home is not just a binary artifact: it carries its own source.
Switch to an existing home generation. This action atomically switches the home profile to the specified home generation.
The target generation can be specified explicitly by its generation number. For example, the following invocation would switch to home generation 7:
guix home switch-generation 7
The target generation can also be specified relative to the current
generation with the form
“3 generations ahead of the current generation,” and
“1 generation prior to the current generation.” When specifying a
negative value such as
-1, you must precede it with
prevent it from being parsed as an option. For example:
guix home switch-generation -- -1
This action will fail if the specified generation does not exist.
Switch to the preceding home generation. This is the inverse
reconfigure, and it is exactly the same as invoking
switch-generation with an argument of
Delete home generations, making them candidates for garbage collection (see Invoking guix gc, for information on how to run the “garbage collector”).
This works in the same way as ‘guix package --delete-generations’ (see --delete-generations). With no arguments, all home generations but the current one are deleted:
guix home delete-generations
You can also select the generations you want to delete. The example below deletes all the home generations that are more than two months old:
guix home delete-generations 2m
Build the derivation of the home environment, which includes all the configuration files and programs needed. This action does not actually install anything.
Describe the current home generation: its file name, as well as provenance information when available.
List a summary of each generation of the home environment available on
disk, in a human-readable way. This is similar to the
--list-generations option of
(see Invoking guix package).
Optionally, one can specify a pattern, with the same syntax that is used
guix package --list-generations, to restrict the list of
generations displayed. For instance, the following command displays
generations that are up to 10 days old:
$ guix home list-generations 10d
Generate a home environment from the packages in the default profile and configuration files found in the user’s home directory. The configuration files will be copied to the specified directory, and a home-configuration.scm will be populated with the home environment. Note that not every home service that exists is supported (see Home Services).
$ guix home import ~/guix-config guix home: '/home/alice/guix-config' populated with all the Home configuration files
And there’s more!
guix home also provides the following
sub-commands to visualize how the services of your home environment
relate to one another:
Emit to standard output the service extension graph of the home
environment defined in file (see Service Composition, for more
information on service extensions). By default the output is in
Dot/Graphviz format, but you can choose a different format with
--graph-backend, as with
guix graph (see --backend):
guix home extension-graph file | xdot -
shows the extension relations among services.
Emit to standard output the dependency graph of shepherd services of the home environment defined in file. See Shepherd Services, for more information and for an example graph.
Again, the default output format is Dot/Graphviz, but you can pass --graph-backend to select a different one.
options can contain any of the common build options (see Common Build Options). In addition, options can contain one of the following:
Consider the home-environment expr evaluates to. This is an alternative to specifying a file which evaluates to a home environment.
guix home reconfigure to allow system downgrades.
guix home reconfigure, by
default, prevents you from downgrading your home to older or unrelated
revisions compared to the channel revisions that were used to deploy
it—those shown by
guix home describe. Using
--allow-downgrades allows you to bypass that check, at the risk
of downgrading your home—be careful!