Previous: Home Services, Up: Home Configuration [Contents][Index]
guix home
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 supported:
search
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 …
As for 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.
As with guix shell
, several options control that container:
Enable networking within the container (it is disabled by default).
As with 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 --
(double
hyphen).
reconfigure
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.
Примечание: It is highly recommended to run
guix pull
once before you runguix home reconfigure
for the first time (see Запуск 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 herd stop
service
or herd restart service
).
This command creates a new generation whose number is one greater than the
current generation (as reported by guix home list-generations
).
If that generation already exists, it will be overwritten. This behavior
mirrors that of guix package
(see Вызов 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 Каналы) 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-generation
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
Нужное поколение также может быть указано относительно текущего поколения
+N
или -N
, где +3
означает "на 3 поколения старше
текущего", а -1
означает "на 1 поколение младше текущего". При
задании отрицательного значения -1
, перед ним нужно поставить
--
чтобы не воспринимать его в качестве опции. Например:
guix home switch-generation -- -1
Это действие завершится ошибкой, если указанное поколение не существует.
roll-back
Switch to the preceding home generation. This is the inverse of
reconfigure
, and it is exactly the same as invoking
switch-generation
with an argument of -1
.
delete-generations
Delete home generations, making them candidates for garbage collection (see Вызов 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
Build the derivation of the home environment, which includes all the configuration files and programs needed. This action does not actually install anything.
describe
Describe the current home generation: its file name, as well as provenance information when available.
list-generations
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 guix package
(see Вызов guix package).
Optionally, one can specify a pattern, with the same syntax that is used in
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
import
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:
extension-graph
Emit to standard output the service extension graph of the home
environment defined in file (see Структура сервисов, 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):
The command:
guix home extension-graph file | xdot -
shows the extension relations among services.
shepherd-graph
Emit to standard output the dependency graph of shepherd services of the home environment defined in file. See Сервисы Shepherd, 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 Стандартные параметры сборки). 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.
Instruct guix home reconfigure
to allow system downgrades.
Just like guix system
, 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!
Previous: Home Services, Up: Home Configuration [Contents][Index]