GNU bug report logs - #74633
[PATCH] ui: Search channels for guix extensions

Previous Next

Package: guix-patches;

Reported by: Brian Kubisiak <brian <at> kubisiak.com>

Date: Sun, 1 Dec 2024 14:54:01 UTC

Severity: normal

Tags: patch

Merged with 74425

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#74633: closed ([PATCH] ui: Search channels for guix extensions)
Date: Sat, 08 Mar 2025 16:40:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 08 Mar 2025 17:39:03 +0100
with message-id <878qpftr2w.fsf <at> gnu.org>
and subject line Re: [bug#74633] [PATCH v4] ui: Search channels for guix extensions
has caused the debbugs.gnu.org bug report #74633,
regarding [PATCH] ui: Search channels for guix extensions
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
74633: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74633
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Brian Kubisiak <brian <at> kubisiak.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] ui: Search channels for guix extensions
Date: Sun, 1 Dec 2024 06:53:03 -0800
* guix/describe.scm (add-channels-to-load-path!): New function.
* gnu/packages.scm (%package-module-path): Call new function. Remove
the code that the function call replaces.
* guix/ui.scm (extension-directories): Call new function. Search
channels for guix extensions.
* guix/self.scm (compiled-guix)[*core-modules*]: Add 'guile-git' to
the list of extensions.

Change-Id: I53af828dc554485ca28389c9e2653ea6b4fb6b7e
---
 gnu/packages.scm  |  7 ++++---
 guix/describe.scm | 13 +++++++++++++
 guix/self.scm     |  1 +
 guix/ui.scm       | 13 ++++++++++---
 4 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/gnu/packages.scm b/gnu/packages.scm
index 80c22d1d7f..05b8bf8e6d 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -147,15 +147,16 @@ (define %package-module-path
   (let* ((not-colon   (char-set-complement (char-set #\:)))
          (environment (string-tokenize (or (getenv "GUIX_PACKAGE_PATH") "")
                                        not-colon))
-         (channels-scm channels-go (package-path-entries)))
+         (channels-scm (package-path-entries)))
     ;; Automatically add channels and items from $GUIX_PACKAGE_PATH to Guile's
     ;; search path.  For historical reasons, $GUIX_PACKAGE_PATH goes to the
     ;; front; channels go to the back so that they don't override Guix' own
     ;; modules.
+    (add-channels-to-load-path!)
     (set! %load-path
-      (append environment %load-path channels-scm))
+      (append environment %load-path))
     (set! %load-compiled-path
-      (append environment %load-compiled-path channels-go))
+      (append environment %load-compiled-path))
 
     (make-parameter
      (append environment
diff --git a/guix/describe.scm b/guix/describe.scm
index a4ca2462f4..3bbda15db5 100644
--- a/guix/describe.scm
+++ b/guix/describe.scm
@@ -27,6 +27,7 @@ (define-module (guix describe)
                                 sexp->channel
                                 manifest-entry-channel)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-34)
   #:use-module (ice-9 match)
   #:export (current-profile
@@ -34,6 +35,7 @@ (define-module (guix describe)
             current-profile-entries
             current-channels
             package-path-entries
+            add-channels-to-load-path!
 
             package-provenance
             package-channels
@@ -190,6 +192,17 @@ (define (package-path-entries)
                                       "/site-ccache")))
                (current-channel-entries))))
 
+(define add-channels-to-load-path!
+  (let ((promise
+         (delay
+           (let-values (((channels-scm channels-go) (package-path-entries)))
+             (set! %load-path
+                   (append %load-path channels-scm))
+             (set! %load-compiled-path
+                   (append %load-compiled-path channels-go))))))
+    (lambda ()
+      (force promise))))
+
 (define (package-channels package)
   "Return the list of channels providing PACKAGE or an empty list if it could
 not be determined."
diff --git a/guix/self.scm b/guix/self.scm
index 2652688c71..28239d53f5 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -882,6 +882,7 @@ (define* (compiled-guix source #:key
                     ,(local-file "../guix/store/schema.sql")))
 
                  #:extensions (list guile-gcrypt
+                                    guile-git     ;for (guix git)
                                     guile-json)   ;for (guix swh)
                  #:guile-for-build guile-for-build))
 
diff --git a/guix/ui.scm b/guix/ui.scm
index eba12c8616..28690b22bc 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -38,6 +38,7 @@
 (define-module (guix ui)                       ;import in user interfaces only
   #:use-module (guix i18n)
   #:use-module (guix colors)
+  #:use-module (guix describe)
   #:use-module (guix diagnostics)
   #:use-module (guix gexp)
   #:use-module (guix sets)
@@ -2192,9 +2193,15 @@ (define* (command-files #:optional directory)
 
 (define (extension-directories)
   "Return the list of directories containing Guix extensions."
-  (filter file-exists?
-          (parse-path
-           (getenv "GUIX_EXTENSIONS_PATH"))))
+  (add-channels-to-load-path!)
+  (let ((channels (package-path-entries)))
+    (filter file-exists?
+            (append
+             (parse-path
+              (getenv "GUIX_EXTENSIONS_PATH"))
+             (map
+              (cut string-append <> "/guix/extensions")
+              channels)))))
 
 (define (commands)
   "Return the list of commands, alphabetically sorted."

base-commit: 369d2698b0bfc3726f8e6d232d43d0dda832225f
prerequisite-patch-id: cd0707c90e1d321f3f16f2f861313dd330e9f0b4
-- 
2.46.0




[Message part 3 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Brian Kubisiak <brian <at> kubisiak.com>
Cc: 74633-done <at> debbugs.gnu.org
Subject: Re: [bug#74633] [PATCH v4] ui: Search channels for guix extensions
Date: Sat, 08 Mar 2025 17:39:03 +0100
[Message part 4 (text/plain, inline)]
Hi Brian,

Brian Kubisiak <brian <at> kubisiak.com> skribis:

> * guix/describe.scm (append-channels-to-load-path!): New function.
> * gnu/packages.scm (%package-module-path): Call new function. Remove
> the code that the function call replaces.
> * guix/ui.scm (extension-directories): Call new function. Search
> channels for guix extensions.
> * guix/self.scm (compiled-guix)[*core-modules*]: Add 'guile-git' to
> the list of extensions.
>
> Change-Id: I53af828dc554485ca28389c9e2653ea6b4fb6b7e

Finally applied, with the cosmetic changes below.

Thanks!

Ludo’.

[Message part 5 (text/x-patch, inline)]
diff --git a/guix/ui.scm b/guix/ui.scm
index 3cc15b05fc..d462f7133e 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -2197,11 +2197,12 @@ (define (extension-directories)
   ;; We need to resolve these lazily, because even using an #:autoload is too
   ;; much and breaks compilation during "guix pull".
   (define append-channels-to-load-path!
-    (module-ref (resolve-module `(guix describe))
-                (symbol-append 'append-channels-to-load-path!)))
+    (module-ref (resolve-interface '(guix describe))
+                'append-channels-to-load-path!))
   (define package-path-entries
-    (module-ref (resolve-module `(guix describe))
-                (symbol-append 'package-path-entries)))
+    (module-ref (resolve-interface '(guix describe))
+                'package-path-entries))
+
   (append-channels-to-load-path!)
   (let ((channels (package-path-entries)))
     (filter file-exists?

This bug report was last modified 128 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.