Rollback does not quite work as expected for me. I am starting without 
.guix-profile in the home directory, and an empty directory 
$PREFIX/var/nix/profiles/per-user/$USER (which I will shorten to $PERUSER 
in the following).

$ guix-package -i hello

This creates a link $HOME/.guix-profile to $PERUSER/guix-profile; the 
latter points to the newly created $PERUSER/guix-profile-1-link

$ guix-package --roll-back
error: no previous profile; not rolling back

No links are changed. I think in this case, rollback should create the 
"empty profile" and have $PERUSER/guix-profile-1-link point to it. 
Alternatively, the empty profile could be created in the beginning, so that 
installing hello would actually create profile number 2. (I think this 
would be the cleanest solution: Upon creation of $HOME/.guix-profile and 
$PERUSER/guix-profile, create a first empty profile $PERUSER/guix-
profile-1-link, and the rollback code could stay the same.)

$ guix-package -i freetype

This creates $PERUSER/guix-profile-2-link and updates the links as 
expected.

$ guix-package --roll-back
switching from generation 2 to 1

Unexpectedly, $PERUSER/guix-profile-2-link is not deleted, but 
$PERUSER/guix-profile now points to $PERUSER/guix-profile-1-link. But we 
need to delete the second profile link, as shown by the following:

$ guix-package -i file
Now $PERUSER/guix-profile-3-link is created, pointing to an environment 
containing hello and file.

$ guix-package --roll-back
switching from generation 3 to 2

Now, we go back to generation 2, containing hello and the mysteriously 
reappeared freetype.

Andreas

Reply via email to