Next: Младшие версии, Previous: Вызов guix pull
, Up: Управление пакетами [Contents][Index]
guix time-machine
Команда guix time-machine
предоставляет доступ к другим версиям
Guix, например, для установки более старых версий пакетов или для
воспроизведения вычислений в идентичной среде. Версия используемого Guix
определяется коммитом или файлом описания канала, созданным guix
describe
(see Вызов guix describe
).
Let’s assume that you want to travel to those days of November 2020 when
version 1.2.0 of Guix was released and, once you’re there, run the
guile
of that time:
guix time-machine --commit=v1.2.0 -- \ environment -C --ad-hoc guile -- guile
The command above fetches Guix 1.2.0 (and possibly other channels
specified by your channels.scm configuration files—see below) and
runs its guix environment
command to spawn an environment in a
container running guile
(guix environment
has since been
subsumed by guix shell
; see Вызов guix shell
). It’s like
driving a DeLorean12! The first guix time-machine
invocation can be expensive: it may have to download or even build a large
number of packages; the result is cached though and subsequent commands
targeting the same commit are almost instantaneous.
As for guix pull
, in the absence of any options,
time-machine
fetches the latest commits of the channels specified
in ~/.config/guix/channels.scm, /etc/guix/channels.scm, or the
default channels; the -q option lets you ignore these configuration
files. The command:
guix time-machine -q -- build hello
will thus build the package hello
as defined in the main branch of
Guix, without any additional channel, which is in general a newer revision
of Guix than you have installed. Time travel works in both directions!
Примечание: The history of Guix is immutable and
guix time-machine
provides the exact same software as they are in a specific Guix revision. Naturally, no security fixes are provided for old versions of Guix or its channels. A careless use ofguix time-machine
opens the door to security vulnerabilities. See --allow-downgrades.
guix time-machine
raises an error when attempting to travel to
commits older than “v0.16.0” (commit ‘4a0b87f0’), dated Dec. 2018.
This is one of the oldest commits supporting the channel mechanism that
makes “time travel” possible.
Примечание: Although it should technically be possible to travel to such an old commit, the ease to do so will largely depend on the availability of binary substitutes. When traveling to a distant past, some packages may not easily build from source anymore. One such example are old versions of OpenSSL whose tests would fail after a certain date. This particular problem can be worked around by running a virtual build machine with its clock set to the right time (see Virtual Build Machines).
Основной синтаксис:
guix time-machine options… -- command arg…
где command и arg… передаются без изменений в команду
guix
указанной ревизии. options, которые определяют эту
ревизию, такие же, как и для guix pull
(see Вызов guix pull
):
--url=url
--commit=commit
--branch=branch
Use the guix
channel from the specified url, at the given
commit (a valid Git commit ID represented as a hexadecimal string or
the name of a tag), or branch.
--channels=file
-C file
Считать список каналов из файла file вместо ~/.config/guix/channels.scm. file должен содержать код Scheme, который определяет список объектов "канал". См. See Каналы для подробной информации.
--no-channel-files
-q
Inhibit loading of the user and system channel files, ~/.config/guix/channels.scm and /etc/guix/channels.scm.
Thus, guix time-machine -q
is equivalent to the following Bash
command, using the “process substitution” syntax (see Process
Substitution in The GNU Bash Reference Manual):
guix time-machine -C <(echo %default-channels) …
Если указанные пакеты ещё не собраны, guix archive
автоматически
соберёт их. Процесс сборки может контролироваться обычными опциями сборки
(see Стандартные параметры сборки).
If guix time-machine
is executed without any command, it prints
the file name of the profile that would be used to execute the command.
This is sometimes useful if you need to get store file name of the
profile—e.g., when you want to guix copy
it.
If you don’t know what a DeLorean is, consider traveling back to the 1980’s. (Back to the Future (1985))
Next: Младшие версии, Previous: Вызов guix pull
, Up: Управление пакетами [Contents][Index]