Next: Inferiors, Previous: Invoking guix pull
, Up: 软件包管理 [Contents][Index]
guix time-machine
The guix time-machine
command provides access to other revisions
of Guix, for example to install older versions of packages, or to reproduce
a computation in an identical environment. The revision of Guix to be used
is defined by a commit or by a channel description file created by
guix describe
(see Invoking 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 runs its guix
environment
command to spawn an environment in a container running
guile
(guix environment
has since been subsumed by
guix shell
; see Invoking 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.
注: 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.
The general syntax is:
guix time-machine options… -- command arg…
where command and arg… are passed unmodified to the
guix
command of the specified revision. The options that
define this revision are the same as for guix pull
(see Invoking 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
Read the list of channels from file. file must contain Scheme code that evaluates to a list of channel objects. See 通道 for more information.
As for guix pull
, the absence of any options means that the latest
commit on the master branch will be used. The command
guix time-machine -- build hello
will thus build the package hello
as defined in the master branch,
which is in general a newer revision of Guix than you have installed. Time
travel works in both directions!
Note that guix time-machine
can trigger builds of channels and
their dependencies, and these are controlled by the standard build options
(see 普通的构建选项).
Next: Inferiors, Previous: Invoking guix pull
, Up: 软件包管理 [Contents][Index]