Subject: [bug#72928] [PATCH] time-machine: Print profile path if no command is given.

From: Tomas Volf <[email-masked]>
Date: Sun, 22 Sep 2024 16:09:52 +0200

Hi,

Simon Tournier <[email-masked]> writes:

> Hi,
>
> On dim., 15 sept. 2024 at 23:29, Ludovic Courtès <[email-masked]> wrote:
>
>>> Printing directory gives nice symmetry between
>>>
>>> $ $(guix build guix)/bin/guix describe
>
> [...]
>
>>> $ $(guix time-machine -q --commit=9a2ddcc8f5a6f64b475eeb13a3f1034aa6a4a49a)/bin/guix describe
>
> [...]
>
>>> And in some cases you need the store item (guix copy?), and in my
>>> opinion it is easier to go from directory to binary than other way
>>> around.
>
> Well, I do not have a strong opinion.  And indeed the symmetry looks
> nice.  However, just to be sure: what’s the use case?  Because
>
>
>     $(guix time-machine -q --commit=9a2ddcc8f5a6f64b475eeb13a3f1034aa6a4a49a)/bin/guix describe
>
> is equivalent to:
>
>     guix time-machine -q --commit=9a2ddcc8f5a6f64b475eeb13a3f1034aa6a4a49a -- describe

That is true.  While I think the symmetry is nice (and goes with
principle of least surprise), I am not interested in running guix this
way.

I am interested in getting the store item for the time-machined version
of guix.  Currently I have two uses in mind:

1. Using `guix copy' to avoid computing the guix derivation when I need
to test something on less powerful machines.  Guix does not built fast,
so this saves both time and electricity.

2. Having something to pass into guix field of guix-configuration.

Guix time-machine works great for both, since it is automatically built,
cached and automatically cleaned after some time.  Only pain point is
getting the profile store path out of it.  With the proposed change it
will be as simple as

--8<---------------cut here---------------start------------->8---
store_item=$(realpath $(guix time-machine -C channels.scm))
--8<---------------cut here---------------end--------------->8---

Does this sufficiently justify the existence of this functionality in
your eyes?

Have a nice day,
Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.