From: Brian Kubisiak <brian@kubisiak.com>
To: 74633@debbugs.gnu.org
Subject: [bug#74633] [PATCH v3] ui: Search channels for guix extensions
Date: Tue, 7 Jan 2025 17:22:35 -0800 [thread overview]
Message-ID: <6a1ff2a779e9cf5248671fc9e62852aa23be3f16.1736299302.git.brian@kubisiak.com> (raw)
In-Reply-To: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@kubisiak.com>
* 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
---
gnu/packages.scm | 7 ++++---
gnu/system/image.scm | 2 +-
guix/describe.scm | 14 ++++++++++++++
guix/self.scm | 1 +
guix/ui.scm | 12 +++++++++---
5 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/gnu/packages.scm b/gnu/packages.scm
index bdd5d21940..ee99dea2ca 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -148,15 +148,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.
+ (append-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/gnu/system/image.scm b/gnu/system/image.scm
index af0f3eb354..e4fdbab634 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -319,7 +319,7 @@ (define gcrypt-sqlite3&co
(match (package-transitive-propagated-inputs package)
(((labels packages) ...)
packages))))
- (list guile-gcrypt guile-sqlite3)))
+ (list guile-gcrypt guile-git guile-json-4 guile-sqlite3)))
(define-syntax-rule (with-imported-modules* gexp* ...)
(with-extensions gcrypt-sqlite3&co
diff --git a/guix/describe.scm b/guix/describe.scm
index a4ca2462f4..90c17084d1 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
+ append-channels-to-load-path!
package-provenance
package-channels
@@ -190,6 +192,18 @@ (define (package-path-entries)
"/site-ccache")))
(current-channel-entries))))
+(define (append-channels-to-load-path!)
+ "Automatically add channels to Guile's search path. Channels are added to the
+end of the path so they don't override Guix' own modules. This function ensures
+that channels are only added to the search path once even if it is called
+multiple times."
+ (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)))
+ (set! append-channels-to-load-path! (lambda () #t)))
+
(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 87a448bf72..05bc99a7e3 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)
@@ -2194,9 +2195,14 @@ (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"))))
+ (append-channels-to-load-path!)
+ (let ((channels (package-path-entries)))
+ (filter file-exists?
+ (parse-path
+ (getenv "GUIX_EXTENSIONS_PATH")
+ (map
+ (cut string-append <> "/guix/extensions")
+ channels)))))
(define (commands)
"Return the list of commands, alphabetically sorted."
base-commit: a76f2d5927c86e4a76a1d3b49c1a37054612f6c0
prerequisite-patch-id: 7835a4f0fbc5e19dcb65195bc9fb69c656915ee1
--
2.47.1
prev parent reply other threads:[~2025-01-08 1:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-01 14:53 [bug#74633] [PATCH] ui: Search channels for guix extensions Brian Kubisiak
2024-12-02 17:25 ` Ludovic Courtès
2024-12-03 11:29 ` Carlo Zancanaro
2024-12-04 0:59 ` Brian Kubisiak
2024-12-05 0:27 ` Carlo Zancanaro via Guix-patches via
2024-12-08 22:03 ` [bug#74633] [PATCH v2] " Brian Kubisiak
2024-12-26 21:08 ` Ludovic Courtès
2025-01-08 1:29 ` Brian Kubisiak
2025-01-08 1:22 ` Brian Kubisiak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a1ff2a779e9cf5248671fc9e62852aa23be3f16.1736299302.git.brian@kubisiak.com \
--to=brian@kubisiak.com \
--cc=74633@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.