Suivant: Inférieurs, Précédent: Invoquer guix pull
, Monter: Gestion de paquets [Table des matières][Index]
guix time-machine
La commande guix time-machine
donne accès à d’autres révisions de
Guix, par exemple pour installer d’anciennes versions de paquets, ou pour
reproduire un calcul dans un environnement identique. La révision de Guix à
utiliser est définie par un commit ou par un fichier de description de canal
créé par guix describe
(voir Invoquer guix describe
).
Supposons que vous vouliez voyager en ces jours de novembre 2020 où la
version 1.2.0 de Guix a été publiée et que, une fois que vous y êtes, vous
lanciez le guile
de cette époque :
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
; voir Invoquer 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!
Remarque : L’histoire de Guix est immuable et
guix time-machine
fournit exactement les mêmes logiciels que ceux de la révision de Guix spécifique. Naturellement, aucun correctif de sécurité n’est fournit pour les anciennes versions de Guix ou ses canaux. Utiliserguix time-machine
sans précaution ouvre la porte à des vulnérabilités de sécurité. Voir --allow-downgrades.
Due to guix time-machine
relying on the “inferiors” mechanism
(voir Inférieurs), the oldest commit it can travel to is commit
‘6298c3ff’ (“v1.0.0”), dated May 1st, 2019, which is the first
release that included the inferiors mechanism. An error is returned when
attempting to navigate to older commits.
Remarque : 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 Python 2 which had time bombs in its test suite, in the form of expiring SSL certificates. This particular problem can be worked around by setting the hardware clock to a value in the past before attempting the build.
La syntaxe générale est :
guix time-machine options… -- commande arg…
où command et arg… sont passés sans modification à la
commande guix
de la révision spécifiée. Les options qui
définissent cette révision sont les mêmes que pour la commande guix
pull
(voir Invoquer guix pull
) :
--url=url
--commit=commit
--branch=branche
Utiliser le canal guix
depuis l’url spécifiée, au commit
donné (un commit Git valide représenté par une chaîne hexadécimale ou le nom
d’une étiquette) ou à la branche branch.
--channels=file
-C file
Lit la liste des canaux dans file. file doit contenir un code Scheme qui s’évalue en une liste d’objets de canaux. Voir Canaux pour plus d’informations.
--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 (voir Process
Substitution dans The GNU Bash Reference Manual):
guix time-machine -C <(echo %default-channels) …
Remarquez que guix time-machine
peut lancer des constructions de
canaux et de leurs dépendances, et qu’elles peuvent être contrôlées avec les
options de construction communes (voir Options de construction communes).
If you don’t know what a DeLorean is, consider traveling back to the 1980’s.
Suivant: Inférieurs, Précédent: Invoquer guix pull
, Monter: Gestion de paquets [Table des matières][Index]