Taking baby steps with Guix (3) : transactions and generations

Guix logo

Summary :

Before going further in this serie on Guix, I must explain something to you!

When you invoke the command guix package, you perform what is called a transaction. This is an atomic action. Either it succeeds or nothing happens. There's no “the system crashed in the middle so we're in a weird state”. I find that very reassuring!

In case a transaction on packages succeed, it has the effect of generating a new generation of a profile (with updated packages, or with more or less packages, ...).

So, in addition to a list of packages per profile, you end up with a list of generations per profile! That you can consult with the following command:

guix package --list-generations
[…]
Generation 3 08 May 2020 08:02:35
 + git 2.26.0 out /gnu/store/117r6fg7cd5cwmmwnda98cxhmdrw6ibg-git-2.26.0

Generation 4 08 May 2020 08:57:29
 + glibc-locales 2.29 out /gnu/store/03nvilh2x4z07dxv7h13gh986vvgpnsf-glibc-locales-2.29

Generation 5 08 May 2020 09:48:35
 + git 2.26.2 out /gnu/store/abqiwgyzlwjz16vd9gvmlnq8zcy12b2l-git-2.26.2
 - git 2.26.0 out /gnu/store/117r6fg7cd5cwmmwnda98cxhmdrw6ibg-git-2.26.0
[…]

They are numbered for easy reference and you can also see the date and time of the generation.

You can navigate from one generation to another as if you were navigating in time. This is useful in case you need to cancel the last generation because it is unstable. Or to compare the behavior of the system between different generations. So help yourself!

Here is the command to use to do this:

# Switch to generation 42
guix package --switch-generation=42
# Switches to the next generation
guix package --switch-generation=+1

To go back one generation, you can execute the command :

$ guix package --roll-back

Warning: Any new transaction will rewrite the history from the generation you are in. Risk of altering the future ;–) !

Useful links :

Thank you very much for reading this article!

Don't hesitate to give me your opinion, suggest an idea for improvement, or ask a question! To do so, leave a comment below or contact me.

And more importantly, share this blog and tell your friends it's the best blog in the history of Free Software! No kidding!

#guix #gnu #linux #hurd #english