installer: referring to N-1 guix is problematic.

OpenSubmitted by Mathieu Othacehe.
Details
3 participants
  • Josselin Poiret
  • Ludovic Courtès
  • Mathieu Othacehe
Owner
unassigned
Severity
important
M
M
Mathieu Othacehe wrote on 12 Jan 17:23 +0100
(address . bug-guix@gnu.org)
87czkw6hzk.fsf@gnu.org
Hello,

If I download the latest installer and use it to install a new system,
the "guix system init" command will install the guix package defined in
the (gnu packages package-management) module.

That means that if the installer is built with a guix package at the
version N in that module, the guix installed by the installer will be at
version N-1.

Besides the fact it is quite disturbing there are at least two major
issues:

* If the guix package is broken, it needs to build updated twice. I
recently added a comment about that:

Toggle snippet (5 lines)
;; If you are updating this package because it fails to build, you need to
;; actually update it *twice*, as the installer is pointing to the N-1 guix
;; package revision.

* When the guix package is updated twice in two separate but near
commits, Cuirass that is checkouting Guix every 5 minutes might miss
the intermediate version of the guix package. Hence, the installation
is taking a while because the guix package is expensive to build.

Any idea on how to improve this inception problem?

Thanks,

Mathieu
L
L
Ludovic Courtès wrote on 12 Jan 18:33 +0100
control message for bug #53210
(address . control@debbugs.gnu.org)
87r19crh94.fsf@gnu.org
severity 53210 important
quit
L
L
Ludovic Courtès wrote on 12 Jan 18:41 +0100
Re: bug#53210: installer: referring to N-1 guix is problematic.
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 53210@debbugs.gnu.org)
87lezkrgvj.fsf@gnu.org
Hi!

Mathieu Othacehe <othacehe@gnu.org> skribis:

Toggle quote (2 lines)
> Any idea on how to improve this inception problem?

We can arrange for ‘installation-os’ to use Guix from the current
commit, as built by (guix self), instead of using the ‘guix’ package.
(For the record, (gnu ci) already does that in ‘system-test-jobs’ to
make installation tests faster.)

I’ll take a look hopefully in the coming days and send a patch here.

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 12 Jan 18:42 +0100
control message for bug #53214
(address . control@debbugs.gnu.org)
87h7a8rguu.fsf@gnu.org
block 53214 by 53210
quit
J
J
Josselin Poiret wrote on 14 Feb 10:29 +0100
[WIP PATCH 0/4] Make current-guix work when run outside a Git checkout
20220214092908.16801-1-dev@jpoiret.xyz
Hello everyone,

I've been working on this for a bit, trying to find the best approach.

First, let me try to summarize the different ways in which Guix can be
run, and how it is built:

* From a `guix pull` profile. This is the most common. The `guix
pull` profile's manifest file holds specific metadata describing the
channels that were used to build the generation, which can be
fetched by `(current-channels)` from (guix describe).

* From a built Guix inside the store, outside a `guix pull` profile.
This is what happens when the user hasn't `guix pull`ed yet after a
Guix System installation, for example. Here, the only available
metadata is the one embedded in (guix config) by the build process,
and (current-channels) returns that one.

* From a Git checkout. Here, there is no build metadata at all.

Furthermore, there are two ways to build Guix: either through the
`guix` package definition, which uses the Makefile, or through
`build-aux/build-self.scm` which uses `guix/self.scm`.

Here, I use the second method, since it's how the current guix is most
likely built. This means that, with proper care, all the derivations
already have their output in the store.

This is only a WIP as there are some unresolved things: I've disabled
authentication, since I'm currently testing my own unsigned patches.
Should we indiscriminately enable it? This would cause some issues
for people that have their own 'guix channel. Maybe we could enable
authentication if the channel URL is the default one? Also, when I
tried to replace the guix in the installer by (current-guix), it ended
up building the Guix derivation multiple times, even though the
package is memoized and the package->derivation process should be
cached.

There's a bit of rift between what the ci uses (renamed here to
channel-profile-build-system) and what current-guix uses, since the
former builds a profile as a package, whereas the latter simply builds
the derivation for the 'guix channel. This avoids creating profile
collisions when the package is added to the system profile, but it
also means we don't get the package cache generation.

Best,

Josselin Poiret (4):
gnu: ci: Move generic channel building code.
gnu: Rename channel-build-system and channel-source->package.
gnu: current-guix: Support when running outside a checkout.
gnu: package-management: Memoize current-guix.

etc/system-tests.scm | 3 +-
gnu/ci.scm | 40 +------------------
gnu/packages/package-management.scm | 60 +++++++++++++++++++++++------
guix/channels.scm | 51 ++++++++++++++++++++++++
4 files changed, 102 insertions(+), 52 deletions(-)

--
2.34.0
J
J
Josselin Poiret wrote on 14 Feb 10:29 +0100
[WIP PATCH 1/4] gnu: ci: Move generic channel building code.
20220214092908.16801-2-dev@jpoiret.xyz
* gnu/ci.scm (channel-build-system): Move to guix/channels.scm.
(channel-source->package): Move to
gnu/packages/package-management.scm.
* guix/channels.scm (channel-build-system): Moved from gnu/ci.scm.
* gnu/packages/package-management.scm (channel-source->package): Moved
from gnu/ci.scm.
* etc/system-tests.scm: Use module (gnu packages package-management)
instead of (gnu ci).
---
etc/system-tests.scm | 1 -
gnu/ci.scm | 38 -----------------------------
gnu/packages/package-management.scm | 16 ++++++++++++
guix/channels.scm | 27 ++++++++++++++++++++
4 files changed, 43 insertions(+), 39 deletions(-)

Toggle diff (163 lines)
diff --git a/etc/system-tests.scm b/etc/system-tests.scm
index 1085deed24..ba0c106553 100644
--- a/etc/system-tests.scm
+++ b/etc/system-tests.scm
@@ -18,7 +18,6 @@
 
 (use-modules (gnu tests)
              (gnu packages package-management)
-             ((gnu ci) #:select (channel-source->package))
              ((guix git-download) #:select (git-predicate))
              ((guix utils) #:select (current-source-directory))
              (git)
diff --git a/gnu/ci.scm b/gnu/ci.scm
index 35fd583f75..be19bda413 100644
--- a/gnu/ci.scm
+++ b/gnu/ci.scm
@@ -32,7 +32,6 @@ (define-module (gnu ci)
   #:use-module (guix channels)
   #:use-module (guix config)
   #:use-module (guix derivations)
-  #:use-module (guix build-system)
   #:use-module (guix monads)
   #:use-module (guix gexp)
   #:use-module (guix ui)
@@ -72,7 +71,6 @@ (define-module (gnu ci)
 
             %core-packages
             %cross-targets
-            channel-source->package
 
             arguments->systems
             cuirass-jobs))
@@ -300,42 +298,6 @@ (define MiB
               '()))
       '()))
 
-(define channel-build-system
-  ;; Build system used to "convert" a channel instance to a package.
-  (let* ((build (lambda* (name inputs
-                               #:key source commit system
-                               #:allow-other-keys)
-                  (mlet* %store-monad ((source (if (string? source)
-                                                   (return source)
-                                                   (lower-object source)))
-                                       (instance
-                                        -> (checkout->channel-instance
-                                            source #:commit commit)))
-                    (channel-instances->derivation (list instance)))))
-         (lower (lambda* (name #:key system source commit
-                               #:allow-other-keys)
-                  (bag
-                    (name name)
-                    (system system)
-                    (build build)
-                    (arguments `(#:source ,source
-                                 #:commit ,commit))))))
-    (build-system (name 'channel)
-                  (description "Turn a channel instance into a package.")
-                  (lower lower))))
-
-(define* (channel-source->package source #:key commit)
-  "Return a package for the given channel SOURCE, a lowerable object."
-  (package
-    (inherit guix)
-    (version (string-append (package-version guix) "+"))
-    (build-system channel-build-system)
-    (arguments `(#:source ,source
-                 #:commit ,commit))
-    (inputs '())
-    (native-inputs '())
-    (propagated-inputs '())))
-
 (define* (system-test-jobs store system
                            #:key source commit)
   "Return a list of jobs for the system tests."
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 03cc9a6612..edef91ff7e 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -114,6 +114,9 @@ (define-module (gnu packages package-management)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
+  ;; This will be loaded by build-self.scm, but guile-git is unavailable, so
+  ;; lazily load instead.
+  #:autoload (guix channels) (channel-build-system guix-channel?)
   #:use-module (guix download)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
@@ -572,6 +575,19 @@ (define (wrong-extension? file)
     (_
      #t)))
 
+(define-public channel-source->package
+  (lambda* (source #:key commit)
+    "Return a package for the given channel SOURCE, a lowerable object."
+    (package
+      (inherit guix)
+      (version (string-append (package-version guix) "+"))
+      (build-system channel-build-system)
+      (arguments `(#:source ,source
+                   #:commit ,commit))
+      (inputs '())
+      (native-inputs '())
+      (propagated-inputs '()))))
+
 (define-public current-guix-package
   ;; This parameter allows callers to override the package that 'current-guix'
   ;; returns.  This is useful when 'current-guix' cannot compute it by itself,
diff --git a/guix/channels.scm b/guix/channels.scm
index 5f47834c10..d637d5863a 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -27,6 +27,7 @@ (define-module (guix channels)
                 #:select (openpgp-public-key-fingerprint
                           openpgp-format-fingerprint))
   #:use-module (guix base16)
+  #:use-module (guix build-system)
   #:use-module (guix records)
   #:use-module (guix gexp)
   #:use-module (guix modules)
@@ -93,6 +94,8 @@ (define-module (guix channels)
             channel-instances->derivation
             ensure-forward-channel-update
 
+            channel-build-system
+
             profile-channels
             manifest-entry-channel
             sexp->channel
@@ -952,6 +955,30 @@ (define* (latest-channel-derivation #:optional (channels %default-channels)
                                                   validate-pull)))
     (channel-instances->derivation instances)))
 
+(define channel-build-system
+  ;; Build system used to "convert" a channel instance to a package.
+  (let* ((build (lambda* (name inputs
+                               #:key source commit system
+                               #:allow-other-keys)
+                  (mlet* %store-monad ((source (if (string? source)
+                                                   (return source)
+                                                   (lower-object source)))
+                                       (instance
+                                        -> (checkout->channel-instance
+                                            source #:commit commit)))
+                    (channel-instances->derivation (list instance)))))
+         (lower (lambda* (name #:key system source commit
+                               #:allow-other-keys)
+                  (bag
+                    (name name)
+                    (system system)
+                    (build build)
+                    (arguments `(#:source ,source
+                                 #:commit ,commit))))))
+    (build-system (name 'channel)
+                  (description "Turn a channel instance into a package.")
+                  (lower lower))))
+
 (define* (sexp->channel sexp #:optional (name 'channel))
   "Read SEXP, a provenance sexp as created by 'channel-instance->sexp'; use
 NAME as the channel name if SEXP does not specify it.  Return #f if the sexp
-- 
2.34.0
J
J
Josselin Poiret wrote on 14 Feb 10:29 +0100
[WIP PATCH 2/4] gnu: Rename channel-build-system and channel-source->package.
20220214092908.16801-3-dev@jpoiret.xyz
* etc/system-tests.scm (tests-for-current-guix):
* gnu/ci.scm (system-test-jobs):
* gnu/packages/package-management.scm (channel-source->package,
current-guix):
* guix/channels.scm (channel-build-system):
Rename channel-build-system to channel-profile-build-system and
channel-source->package to channel-source->profile-package.
---
etc/system-tests.scm | 2 +-
gnu/ci.scm | 2 +-
gnu/packages/package-management.scm | 4 ++--
guix/channels.scm | 7 ++++---
4 files changed, 8 insertions(+), 7 deletions(-)

Toggle diff (73 lines)
diff --git a/etc/system-tests.scm b/etc/system-tests.scm
index ba0c106553..ae5e604e10 100644
--- a/etc/system-tests.scm
+++ b/etc/system-tests.scm
@@ -48,7 +48,7 @@ (define (tests-for-current-guix source commit)
   ;;
   ;;   make check-system TESTS=installed-os
   (parameterize ((current-guix-package
-                  (channel-source->package source #:commit commit)))
+                  (channel-source->profile-package source #:commit commit)))
     (match (getenv "TESTS")
       (#f
        (all-system-tests))
diff --git a/gnu/ci.scm b/gnu/ci.scm
index be19bda413..1848015194 100644
--- a/gnu/ci.scm
+++ b/gnu/ci.scm
@@ -319,7 +319,7 @@ (define (->job test)
       ;; expensive.  It also makes sure we get a valid Guix package when this
       ;; code is not running from a checkout.
       (parameterize ((current-guix-package
-                      (channel-source->package source #:commit commit)))
+                      (channel-source->profile-package source #:commit commit)))
         (map ->job (all-system-tests)))
       '()))
 
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index edef91ff7e..35913e6153 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -575,13 +575,13 @@ (define (wrong-extension? file)
     (_
      #t)))
 
-(define-public channel-source->package
+(define-public channel-source->profile-package
   (lambda* (source #:key commit)
     "Return a package for the given channel SOURCE, a lowerable object."
     (package
       (inherit guix)
       (version (string-append (package-version guix) "+"))
-      (build-system channel-build-system)
+      (build-system channel-profile-build-system)
       (arguments `(#:source ,source
                    #:commit ,commit))
       (inputs '())
diff --git a/guix/channels.scm b/guix/channels.scm
index d637d5863a..01f63d9631 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -94,7 +94,7 @@ (define-module (guix channels)
             channel-instances->derivation
             ensure-forward-channel-update
 
-            channel-build-system
+            channel-profile-build-system
 
             profile-channels
             manifest-entry-channel
@@ -955,8 +955,9 @@ (define* (latest-channel-derivation #:optional (channels %default-channels)
                                                   validate-pull)))
     (channel-instances->derivation instances)))
 
-(define channel-build-system
-  ;; Build system used to "convert" a channel instance to a package.
+(define channel-profile-build-system
+  ;; Build system used to "convert" a channel instance to a profile, in
+  ;; package form.
   (let* ((build (lambda* (name inputs
                                #:key source commit system
                                #:allow-other-keys)
-- 
2.34.0
J
J
Josselin Poiret wrote on 14 Feb 10:29 +0100
[WIP PATCH 3/4] gnu: current-guix: Support when running outside a checkout.
20220214092908.16801-4-dev@jpoiret.xyz
* guix/channels.scm (channel-build-system): Add build system that
turns a channel record into a package.
* gnu/packages/package-management.scm (current-guix): Use
channel-build-system.
---
gnu/packages/package-management.scm | 45 +++++++++++++++++++++--------
guix/channels.scm | 23 +++++++++++++++
2 files changed, 56 insertions(+), 12 deletions(-)

Toggle diff (121 lines)
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 35913e6153..fe906fd440 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -116,10 +116,14 @@ (define-module (gnu packages package-management)
   #:use-module (guix build-system trivial)
   ;; This will be loaded by build-self.scm, but guile-git is unavailable, so
   ;; lazily load instead.
-  #:autoload (guix channels) (channel-build-system guix-channel?)
+  #:autoload (guix channels) (channel-profile-build-system
+                              channel-build-system
+                              guix-channel?)
+  #:use-module (guix describe)
   #:use-module (guix download)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
+  #:autoload (guix git) (git-checkout)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix utils)
@@ -588,6 +592,18 @@ (define-public channel-source->profile-package
       (native-inputs '())
       (propagated-inputs '()))))
 
+(define-public channel->package
+  (lambda (channel)
+    "Return a package for the given CHANNEL."
+    (package
+      (inherit guix)
+      (version (string-append (package-version guix) "+"))
+      (build-system channel-build-system)
+      (arguments `(#:channel ,channel))
+      (inputs '())
+      (native-inputs '())
+      (propagated-inputs '()))))
+
 (define-public current-guix-package
   ;; This parameter allows callers to override the package that 'current-guix'
   ;; returns.  This is useful when 'current-guix' cannot compute it by itself,
@@ -595,22 +611,27 @@ (define-public current-guix-package
   (make-parameter #f))
 
 (define-public current-guix
-  (let* ((repository-root (delay (canonicalize-path
-                                  (string-append (current-source-directory)
-                                                 "/../.."))))
-         (select? (delay (or (git-predicate (force repository-root))
-                             source-file?))))
-    (lambda ()
-      "Return a package representing Guix built from the current source tree.
-This works by adding the current source tree to the store (after filtering it
-out) and returning a package that uses that as its 'source'."
+  (lambda ()
+    "Return a package representing Guix built from the currently used one.
+This works by either looking up profile or build metadata, and building from
+the current Guix channel.  If that metadata is missing, assume we are running
+from a Git checkout, so add the current source tree to the store (after
+filtering it out) and return a package that uses that as its 'source'."
+    (let* ((guix-channel (find guix-channel? (current-channels)))
+           (repository-root (canonicalize-path
+                             (string-append (current-source-directory)
+                                            "/../..")))
+           (select? (or (git-predicate  repository-root)
+                        source-file?)))
       (or (current-guix-package)
+          (and guix-channel
+               (channel->package guix-channel))
           (package
             (inherit guix)
             (version (string-append (package-version guix) "+"))
-            (source (local-file (force repository-root) "guix-current"
+            (source (local-file repository-root "guix-current"
                                 #:recursive? #t
-                                #:select? (force select?))))))))
+                                #:select? select?)))))))
 
 (define-public guix-icons
   (package
diff --git a/guix/channels.scm b/guix/channels.scm
index 01f63d9631..c930fd2ae7 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -94,6 +94,7 @@ (define-module (guix channels)
             channel-instances->derivation
             ensure-forward-channel-update
 
+            channel-build-system
             channel-profile-build-system
 
             profile-channels
@@ -955,6 +956,28 @@ (define* (latest-channel-derivation #:optional (channels %default-channels)
                                                   validate-pull)))
     (channel-instances->derivation instances)))
 
+(define channel-build-system
+  ;; Build system used to "convert" a channel to a package.
+  (let* ((build (lambda* (name inputs
+                               #:key channel system
+                               #:allow-other-keys)
+                  (mlet* %store-monad ((instance
+                                        ((store-lift latest-channel-instance)
+                                         channel
+                                         #:authenticate? #f
+                                         #:validate-pull (lambda (. rest) #t))))
+                    (build-from-source instance #:system system))))
+         (lower (lambda* (name #:key system channel
+                               #:allow-other-keys)
+                  (bag
+                    (name name)
+                    (system system)
+                    (build build)
+                    (arguments `(#:channel ,channel))))))
+    (build-system (name 'channel)
+                  (description "Turn a channel into a package.")
+                  (lower lower))))
+
 (define channel-profile-build-system
   ;; Build system used to "convert" a channel instance to a profile, in
   ;; package form.
-- 
2.34.0
J
J
Josselin Poiret wrote on 14 Feb 10:29 +0100
[WIP PATCH 4/4] gnu: package-management: Memoize current-guix.
20220214092908.16801-5-dev@jpoiret.xyz
* gnu/packages/package-management.scm (current-guix): Memoize.
---
gnu/packages/package-management.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (23 lines)
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index fe906fd440..a7b98bbb1a 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -125,6 +125,7 @@ (define-module (gnu packages package-management)
   #:use-module (guix git-download)
   #:autoload (guix git) (git-checkout)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix memoization)
   #:use-module (guix packages)
   #:use-module (guix utils)
   #:use-module (ice-9 match)
@@ -611,7 +612,7 @@ (define-public current-guix-package
   (make-parameter #f))
 
 (define-public current-guix
-  (lambda ()
+  (mlambda ()
     "Return a package representing Guix built from the currently used one.
 This works by either looking up profile or build metadata, and building from
 the current Guix channel.  If that metadata is missing, assume we are running
-- 
2.34.0
L
L
Ludovic Courtès wrote on 14 Feb 18:10 +0100
Re: [WIP PATCH 0/4] Make current-guix work when run outside a Git checkout
(name . Josselin Poiret)(address . dev@jpoiret.xyz)
877d9xv0fa.fsf@gnu.org
Hello,

Thanks for working on it!

Josselin Poiret <dev@jpoiret.xyz> skribis:

Toggle quote (6 lines)
> This is only a WIP as there are some unresolved things: I've disabled
> authentication, since I'm currently testing my own unsigned patches.
> Should we indiscriminately enable it? This would cause some issues
> for people that have their own 'guix channel. Maybe we could enable
> authentication if the channel URL is the default one?

How about adding a keyword argument to ‘channel-build-system’,
defaulting to true?

Toggle quote (5 lines)
> Also, when I tried to replace the guix in the installer by
> (current-guix), it ended up building the Guix derivation multiple
> times, even though the package is memoized and the package->derivation
> process should be cached.

‘current-guix’ returns a fresh package object every time it’s called:

(define-public current-guix
(lambda ()
(package …)))

This defeats the object-to-derivation cache, which relies on object
identity (eq?). So yes, you definitely have to turn it into ‘mlambda’.

Why that’s no enough, I don’t know.

Toggle quote (7 lines)
> There's a bit of rift between what the ci uses (renamed here to
> channel-profile-build-system) and what current-guix uses, since the
> former builds a profile as a package, whereas the latter simply builds
> the derivation for the 'guix channel. This avoids creating profile
> collisions when the package is added to the system profile, but it
> also means we don't get the package cache generation.

As discussed on IRC, I think the file-level collisions are fine: unless
I’m mistaken, it’s the ‘manifest’ file of the real profile that “wins”,
so it doesn’t really matter that the ‘guix’ package also provides a
‘manifest’ file.

What’s more problematic though is that it means that
“/run/current-system/profile/bin/guix describe” would now fail (I think?
Can you confirm?) since it gets its provenance data from the profile
it’s in.

WDYT?

Ludo’.
L
L
Ludovic Courtès wrote on 14 Feb 18:12 +0100
Re: [WIP PATCH 1/4] gnu: ci: Move generic channel building code.
(name . Josselin Poiret)(address . dev@jpoiret.xyz)
8735klv0d1.fsf@gnu.org
Josselin Poiret <dev@jpoiret.xyz> skribis:

Toggle quote (9 lines)
> * gnu/ci.scm (channel-build-system): Move to guix/channels.scm.
> (channel-source->package): Move to
> gnu/packages/package-management.scm.
> * guix/channels.scm (channel-build-system): Moved from gnu/ci.scm.
> * gnu/packages/package-management.scm (channel-source->package): Moved
> from gnu/ci.scm.
> * etc/system-tests.scm: Use module (gnu packages package-management)
> instead of (gnu ci).

How about making it (guix build-system channel), to be consistent with
other build systems?
L
L
Ludovic Courtès wrote on 14 Feb 18:15 +0100
Re: [WIP PATCH 3/4] gnu: current-guix: Support when running outside a checkout.
(name . Josselin Poiret)(address . dev@jpoiret.xyz)
87wnhxtlnh.fsf@gnu.org
Josselin Poiret <dev@jpoiret.xyz> skribis:

Toggle quote (5 lines)
> * guix/channels.scm (channel-build-system): Add build system that
> turns a channel record into a package.
> * gnu/packages/package-management.scm (current-guix): Use
> channel-build-system.

[...]

Toggle quote (23 lines)
> (define-public current-guix
> - (let* ((repository-root (delay (canonicalize-path
> - (string-append (current-source-directory)
> - "/../.."))))
> - (select? (delay (or (git-predicate (force repository-root))
> - source-file?))))
> - (lambda ()
> - "Return a package representing Guix built from the current source tree.
> -This works by adding the current source tree to the store (after filtering it
> -out) and returning a package that uses that as its 'source'."
> + (lambda ()
> + "Return a package representing Guix built from the currently used one.
> +This works by either looking up profile or build metadata, and building from
> +the current Guix channel. If that metadata is missing, assume we are running
> +from a Git checkout, so add the current source tree to the store (after
> +filtering it out) and return a package that uses that as its 'source'."
> + (let* ((guix-channel (find guix-channel? (current-channels)))
> + (repository-root (canonicalize-path
> + (string-append (current-source-directory)
> + "/../..")))
> + (select? (or (git-predicate repository-root)
> + source-file?)))

We should keep these two variables as promises in the closure, to make
sure we don’t recompute them over and over… unless ‘lambda’ is changed
to ‘mlambda’ in the same commit, which is probably the best course of
action.
?