[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to install previous versions?

From: zimoun
Subject: Re: How to install previous versions?
Date: Sat, 10 Oct 2020 18:44:27 +0200


On Sat, 10 Oct 2020 at 17:15, Zelphir Kaltstahl
<> wrote:

> For example, clicking leads to:
> Here is where I am lost. Where do I need to click?

Click on one date.  The row is:

     Version Output Builds From To

and From mean the date of the first commit where the package is at the
version Version.
To is the date of the last commit.

> And this gives you the commit with 'python-redis@3.8', using the command:
>   guix time-machine --commit=f5111b \
>          -- environment --ad-hoc python-redis python \
>          -- python
> OK, assume I get the commit id.
> I just tried this with the following command:
> ~~~~
> guix time-machine --commit=f5111b -- environment --ad-hoc 
> 'python-redis@3.3.8' 'python@3.8' -- python3.8
> ~~~~

Remove the '@X.Y'.  It does not make sense since it is somehow already
included by the specification of the commit.

> My guess is, that in this commit of Guix there was no Python 3.8.2 yet? Or 
> perhaps `python-redis` was not build for that Python version?

The "guix time-machine" gives you the exact same Guix as it was at the
commit specification.  Therefore, since the commit f5111b provides the
version of python-redis you want, all the others do matter.

> I do not have a specific use-case at this moment, but I would like to know 
> how to get those specific versions, the same every single time I run the 
> command. To compare, when I create a virtual environment using:

As I have tried to explain. :-)

In your project directory, you have to add 2 files about Guix:

   guix describe -f channels > channels.scm

and the manifest.scm file containing the list of packages the project
requires.  Then at any point in time, you can always do:

   guix time-machine -C channels.scm -- <subcommand> -m manifest <options>

> ~~~~
> python3 -m venv venv
> source venv/bin/activate
> pip install --requirement requirements.txt
> ~~~~

The issue with this approach is that somehow you need a SAT solver.
But that's another story. ;-)

With Guix, AFAICT, the similar is:
 - channels.scm which specifies a Guix version and so packages versions
 - manifest.scm which specifies the list of packages.

> But that is, what I already have, isn't it? There is no part in this, that 
> indicates `guix time-machine`. If time-machine is necessary to get the older 
> version of python-redis@3.3.8 in the command line, then there must be 
> something I need to write in the manifest.scm file to let Guix know, that I 
> want a specific commit id. Or perhaps this is not possible with a manifest? 
> Or is the idea, that I need to have a tracked channel as well to achieve it?

It is possible with the manifest but AFAIU it is a bit tricky and you
should write some Scheme.  The easiest is using a channels.scm file.
See above.

> The other no-so-said is to track "guix describe", you *should* _track_
> the file channels.scm:
>    guix describe -f channels.scm
> OK this is probably the part, where I need to read the docs about it. I do 
> not have a channels.scm and I do not know what does in there. I only have a 
> vague idea about channels in my head.

Maybe with the output is easier to get the point. :-)

--8<---------------cut here---------------start------------->8---
$ guix describe -f channels
(list (channel
        (name 'guix)
        (url "";)
              "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA")))))
--8<---------------cut here---------------end--------------->8---

Basically, I have only one channel which is the official GNU Guix
"%default-channels".  The important information here are:

 - url: from where it fetch
 - commit: which checkout uses

Therefore, "guix time-machine -C the/channel./file.scm -- help" will
fetch from url and restore at the commit.

The other parts are important too. ;-)  But not for your question. :-)
Well, basically you can even drop them and it will be fine.

So yes, please go read the channel section.  It has recently been
reordered to be more "understandable".  Feedback is very welcome. :-)

> Then later or on another machine, you simply run the command:
>    guix time-machine -C path/to/channels.scm \
>           -- <subcommand> -m path/to/manifest.scm <options>
> If I understand this correctly, a manifest with specific versions can only be 
> guaranteed to work, if I track a channel as well. And somehow in that channel 
> definition, I must specify which commit of Guix I am on? But wouldn't that 
> limit my choice of libraries to what was available in one commit?

Yes, the same way the choice of libraries is limited at each commit state. :-)

It is possible to mix libraries from different commits but the UI is
not as easy as it should be.

For example, imagine you are doing:

  guix pull
  guix install -m foo.scm /tmp/A
  [...] # time flies
  guix pull
  guix install -m bar.scm /tmp/B

And let assume that foo and bar are *not* coming from the same Guix
commit.  You can still do:

  guix package --search-paths -p /tmp/A -p /tmp/B

and therefore mix the two libraries.

Well, using the time-machine, you need to track the commit which
provided foo and the one of bar.  Then:

  guix time-machine --commit=commit-A -- install -m foo.scm -p /tmp/AA
  guix time-machine --commit=commit-B -- install -m bar.scm -p /tmp/BB

Then "guix package --search-paths -p /tmp/AA -p /tmp/BB" should
provide the exact same thing as before.

That's why it is important to track the Guix commit (guix describe -f
channels) of software you are installing.  Without this piece of
information, it is (almost) impossible to reinstall (other point in
time or space) the exact same version of the very software.

Hope that helps,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]