Subject: bug#56441: guix time-machine broken by profiles speed-up

From: Ludovic Courtès <[email-masked]>
Date: Fri, 08 Jul 2022 22:42:13 +0200

Ricardo Wurmus <[email-masked]> skribis:

> Attached is a patch that attempts to build the manifest in an inferior.
> This fails because manifest->gexp returns a gexp that we can’t get out
> of the inferior to pass to build-profile.

Thanks for sharing!  This sounded like the “right” approach, but there’s
a part that made me feel uneasy about it:

> +    (define (manifest-gexp)
> +      (pk 'man-gexp
> +          (if inferior-guix
> +              (let* ((inferior (open-inferior inferior-guix))
> +                     (result
> +                      ;; TODO: this doesn't work because we can't lift the
> +                      ;; gexp out of the inferior.
> +                      (inferior-eval `(begin
> +                                        (use-modules (guix profiles)
> +                                                     (guix derivations))
> +                                        ((@@ (guix profiles) manifest->gexp)
> +                                         (manifest
> +                                          (list
> +                                           ,@(map (lambda (entry)
> +                                                    `(manifest-entry
> +                                                       (name ,(manifest-entry-name entry))
> +                                                       (version ,(manifest-entry-version entry))
> +                                                       (output ,(manifest-entry-output entry))
> +                                                       (item (read-derivation-from-file
> +                                                              ,(derivation-file-name
> +                                                                (manifest-entry-item entry))))))
> +                                                  (manifest-entries manifest))))))

Here we have to rely on a larger part of the API: a subset of (guix
profiles) and (guix derivations).

Conversely, in (guix channels), the only assumption made about the API
implemented by the other Guix (which might be older or might be newer)
is the ‘generate-package-cache’ procedure.  It’s a small requirement, so
potentially easier to satisfy in future versions for a long time.

When dealing with these time travel issues, I feel we have difficult
choices to make.  It’s a bit of an unusual requirement that we have.

Ludo’.