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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Brian Kubisiak <brian@HIDDEN>; Keywords: patch; merged with #74425; dated Sun, 1 Dec 2024 14:54:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 74633 <at> debbugs.gnu.org:


Received: (at 74633) by debbugs.gnu.org; 10 Jan 2025 19:03:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 10 14:03:20 2025
Received: from localhost ([127.0.0.1]:58820 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tWKHv-0002PT-J0
	for submit <at> debbugs.gnu.org; Fri, 10 Jan 2025 14:03:20 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:57184)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tWKHt-0002P5-85
 for 74633 <at> debbugs.gnu.org; Fri, 10 Jan 2025 14:03:17 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1tWKHn-00039i-LU; Fri, 10 Jan 2025 14:03:11 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=Iu23VHIf/bKTLJF1Vcua3Z6hfYs0vH6+bgEJeQ2w08g=; b=d7fUTUX4MBJzc/1vkuC/
 LoEuMxsVT8O52PSNk8i3zpwQsNrTv9d2wkJ/Vc85W+27NcIj4C+ID14kf7kELvHwhlFrBo43YkYUH
 V2vwCg7vkqgHzVFSon2kmESOh9YPdlFmNcDvGHSMgfsm2HLETTnHc8yOujLppT4h/kBNk243vbTvz
 yCm+kAf2XEJY/Rt8Ov3b4Ac03f5A8bMSAGXtdzu+aFX0ZXEpcDTg3u4RrxDvggrfYu4QS7ro3J/p0
 OxuFWAqseryPmEAakUObEKiSxEWUW9xG4u2L4LXffuEOKkrh2CnHB40Vf4PCE2Y4xvH6NELhK9ztT
 0m1uzyQ0isexSg==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Brian Kubisiak <brian@HIDDEN>
Subject: Re: [bug#74633] [PATCH v3] ui: Search channels for guix extensions
In-Reply-To: <6a1ff2a779e9cf5248671fc9e62852aa23be3f16.1736299302.git.brian@HIDDEN>
 (Brian Kubisiak's message of "Tue, 7 Jan 2025 17:22:35 -0800")
References: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@HIDDEN>
 <6a1ff2a779e9cf5248671fc9e62852aa23be3f16.1736299302.git.brian@HIDDEN>
Date: Fri, 10 Jan 2025 20:03:03 +0100
Message-ID: <87v7umjxug.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 74633
Cc: 74633 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hello,

Overall it LGTM.  I propose the mostly-cosmetic changes below.

Once thing I overlooked before is that commands will have to live under
/guix/extensions, right?

  (define (commands)
    "Return the list of commands, alphabetically sorted."
    (filter-map source-file-command
                (append (command-files)
                        (append-map command-files
                                    (extension-directories)))))

And likewise in =E2=80=98run-guix-command=E2=80=99.

But now, if a channel provides =E2=80=98guix/scripts/foo.scm=E2=80=99, the =
=E2=80=98guix help=E2=80=99
command will not show =E2=80=98foo=E2=80=99 but the =E2=80=98guix foo=E2=80=
=99 command will effectively
work (which wasn=E2=80=99t the case until now).

Maybe it=E2=80=99s fine actually, I don=E2=80=99t know, but I thought this =
is worth
mentioning and thinking though.

WDYT?

Ludo=E2=80=99.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline

diff --git a/guix/describe.scm b/guix/describe.scm
index 90c17084d1..819f0fef74 100644
--- a/guix/describe.scm
+++ b/guix/describe.scm
@@ -27,8 +27,8 @@ (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 (srfi srfi-71)
   #:use-module (ice-9 match)
   #:export (current-profile
             current-profile-date
@@ -194,10 +194,11 @@ (define (package-path-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)))
+end of the path so they don't override Guix' own modules.
+
+This procedure ensures that channels are only added to the search path once
+even if it is called multiple times."
+  (let ((channels-scm channels-go (package-path-entries)))
     (set! %load-path
           (append %load-path channels-scm))
     (set! %load-compiled-path
diff --git a/guix/ui.scm b/guix/ui.scm
index 05bc99a7e3..d9d7c8469f 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -38,7 +38,8 @@
 (define-module (guix ui)                       ;import in user interfaces only
   #:use-module (guix i18n)
   #:use-module (guix colors)
-  #:use-module (guix describe)
+  #:autoload   (guix describe) (append-channels-to-load-path!
+                                package-path-entries)
   #:use-module (guix diagnostics)
   #:use-module (guix gexp)
   #:use-module (guix sets)
@@ -2200,9 +2201,8 @@ (define (extension-directories)
     (filter file-exists?
             (parse-path
              (getenv "GUIX_EXTENSIONS_PATH")
-             (map
-              (cut string-append <> "/guix/extensions")
-              channels)))))
+             (map (cut string-append <> "/guix/extensions")
+                  channels)))))
 
 (define (commands)
   "Return the list of commands, alphabetically sorted."

--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#74633; Package guix-patches. Full text available.

Message received at 74633 <at> debbugs.gnu.org:


Received: (at 74633) by debbugs.gnu.org; 8 Jan 2025 01:29:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 07 20:29:29 2025
Received: from localhost ([127.0.0.1]:45330 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tVKsz-0003ic-Ip
	for submit <at> debbugs.gnu.org; Tue, 07 Jan 2025 20:29:29 -0500
Received: from [75.171.110.13] (port=2045 helo=mail.kubisiak.com)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <brian@HIDDEN>)
 id 1tVKst-0003iD-Ji
 for 74633 <at> debbugs.gnu.org; Tue, 07 Jan 2025 20:29:27 -0500
dkim-signature: v=1; a=rsa-sha256; d=kubisiak.com; s=s1;
 c=relaxed/relaxed; q=dns/txt;
 h=From:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type:In-Reply-To:References;
 bh=8zud61gXdWY6iD66fqMBV96Iq2Acueka0H7DgWT3b/Y=;
 b=NADIqJV9O9EM5XEy5SLPxsXUA6wpOyOa67HX1YYUcvWCP2VVGoxqFPCfRICL0WxHB1GWl+a9CD6etF+OB33mPSu8cwqnt4t/Z9eQJLPXjbrskx+TbtX/IgDrvCEeHJ8IQsj9HXa8wWEpN+5nIKb1DD07h1LDCKQpPh9BJ2wDvRdKKSGx232Y8+tN6rKhgqvvPDX63uE16EZz7GyiT587sHlNa3NH+K0iTNQLZIj6KaHWWcc3DgHYnG/lZF
 UUFDZPXUe5InFMTiFsAcMKSETPkwZdgjjmlmvmleLDZ+hu88i6L1H8ZEOgOCAe5X0BUtvAn+UgJJrlsf6rluPwB1FYrA==
Received: from peregrine (135-180-130-213.dsl.dynamic.sonic.net
 [135.180.130.213]) (envelope-sender <brian@HIDDEN>)
 by mail.kubisiak.com with ESMTPSA
 id <4ke6rxdjqgco4quclch6erzjtkz33pz6ofzbh6xzgshpc3us63@ohfmoaq2dnzg>
 for <Undisclosed Recipients>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256)
 ; Tue, 7 Jan 2025 19:29:08 -0600
Date: Tue, 7 Jan 2025 17:29:07 -0800
From: Brian Kubisiak <brian@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#74633] [PATCH v2] ui: Search channels for guix extensions
Message-ID: <4ke6rxdjqgco4quclch6erzjtkz33pz6ofzbh6xzgshpc3us63@ohfmoaq2dnzg>
References: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@HIDDEN>
 <2c078699007e847611b7a20679621813691d9db3.1733695255.git.brian@HIDDEN>
 <87plle17a3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87plle17a3.fsf@HIDDEN>
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  > Could you send a v3 along these lines, if you think that
 makes sense? Sent. Note that during testing I noticed that guile-git (and
 guile-json-4) needed to be added as dependencies to a g-expression that
 imported
 guix/build/utils.scm due to the additional dependencies in [...] 
 Content analysis details:   (1.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The
 query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [75.171.110.13 listed in sa-trusted.bondedsender.org]
 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The
 query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [75.171.110.13 listed in bl.score.senderscore.com]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS
X-Debbugs-Envelope-To: 74633
Cc: 74633 <at> debbugs.gnu.org, Carlo Zancanaro <carlo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

> Could you send a v3 along these lines, if you think that makes sense?

Sent. Note that during testing I noticed that guile-git (and
guile-json-4) needed to be added as dependencies to a g-expression
that imported guix/build/utils.scm due to the additional dependencies
introduced in this patch. I'm probably missing more places where this
is required and Carlo's lazy import may be a better option to avoid
issues like this. Let me know what you think, I can send another
version if you think that's better.

> > +++ 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)))
>
> This variable is now unused; I think it can be removed.

This is still used in the below make-parameter call (not shown in the
patch), so I've left it in.

Thanks,
Brian





Information forwarded to guix-patches@HIDDEN:
bug#74633; Package guix-patches. Full text available.

Message received at 74633 <at> debbugs.gnu.org:


Received: (at 74633) by debbugs.gnu.org; 8 Jan 2025 01:22:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 07 20:22:47 2025
Received: from localhost ([127.0.0.1]:45320 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tVKmU-0003BF-Vf
	for submit <at> debbugs.gnu.org; Tue, 07 Jan 2025 20:22:47 -0500
Received: from [75.171.110.13] (port=2322 helo=mail.kubisiak.com)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <brian@HIDDEN>)
 id 1tVKmS-0003Az-9K
 for 74633 <at> debbugs.gnu.org; Tue, 07 Jan 2025 20:22:45 -0500
dkim-signature: v=1; a=rsa-sha256; d=kubisiak.com; s=s1;
 c=relaxed/relaxed; q=dns/txt;
 h=From:Subject:Date:Message-ID:To:MIME-Version:Content-Type; 
 bh=I/HLI0WgpjXIb5hF9dcOAD8f5y7OGug/3heWVAuhw/8=;
 b=kRxUvGjGfZuPKN1Y2AzoEbJKC5mgL0PDL7ZgRotvifdx8ln+AeSXnTeraufZ6Rk7Ob8XdPCBEPWhv7H+/chC+mjxaeIBlExv3x/oWnvbKVc0iGYSAxfEr+Bqzn7L/K2yoBGrI1JJdk0Chf91kujfPejoJIcAajnqXFonO1/35SYwmYzERIxIe8VFOH9gKBqnLq4lGCObCCGYdWOd85EvNMbMhelz5X7YrouWlEnEV86Jds3fvizZUwS9lA
 fD5SXM9a3CgDxCrIkUkYtIWLdlhvCtKW2+XM2D1ZV3Yan+g7noCy7euPQhLiQoTjYCBLVbJpwiCqmMTcKTHUviV8N/Vw==
Received: from peregrine (135-180-130-213.dsl.dynamic.sonic.net
 [135.180.130.213]) (envelope-sender <brian@HIDDEN>)
 by mail.kubisiak.com with ESMTPSA id
 <6a1ff2a779e9cf5248671fc9e62852aa23be3f16.1736299302.git.brian@HIDDEN>
 for <74633 <at> debbugs.gnu.org>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256)
 ; Tue, 7 Jan 2025 19:22:36 -0600
Date: Tue, 7 Jan 2025 17:22:35 -0800
From: Brian Kubisiak <brian@HIDDEN>
To: 74633 <at> debbugs.gnu.org
Subject: [PATCH v3] ui: Search channels for guix extensions
Message-ID: <6a1ff2a779e9cf5248671fc9e62852aa23be3f16.1736299302.git.brian@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: * 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 (extensi [...] 
 Content analysis details:   (1.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The
 query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [75.171.110.13 listed in sa-accredit.habeas.com]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The
 query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [75.171.110.13 listed in bl.score.senderscore.com]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS
X-Debbugs-Envelope-To: 74633
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

* 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






Information forwarded to guix-patches@HIDDEN:
bug#74633; Package guix-patches. Full text available.
Merged 74425 74633. Request was from Ludovic Courtès <ludo@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 74633 <at> debbugs.gnu.org:


Received: (at 74633) by debbugs.gnu.org; 26 Dec 2024 21:09:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 26 16:09:07 2024
Received: from localhost ([127.0.0.1]:42432 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tQv6Q-00024L-Vu
	for submit <at> debbugs.gnu.org; Thu, 26 Dec 2024 16:09:07 -0500
Received: from eggs.gnu.org ([209.51.188.92]:38298)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1tQv6O-00023m-5n
 for 74633 <at> debbugs.gnu.org; Thu, 26 Dec 2024 16:09:05 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1tQv6H-0001sk-9r; Thu, 26 Dec 2024 16:08:57 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=EJhQIpzrCZ6S0AYAiZ7O44b49JFJaKTD8IO96MQgQNI=; b=H6On5hmIn5Aenxv+q4ok
 RVBQ5kuOSqDL0fKTXnWkiChpoL2MXgtXJT3DdoSZaV8lWdZu8fHybc4ndv/8YAsz6ORQ/PNvoEnj3
 WUpNT+vTnYe5UE0Z0gI9SKh8awfBHBhza/96rJ7bOgg+rZNNZMHDliNvET91jzpTkVVRWm8OGSVkC
 03WOOo8r6lSL2HWq4TE/P3h8Dt/prJOVJR60x+cQFLSXarrU8y5QXJOtFOEYxj6PKDuasqqsVeHju
 zaQSKuPW4IYs6xf6X34YGM14J2dWaXIiq/mzTsOoAffVGeh8oQksipbXtFE4wWem9CepmN5P/cKUh
 kBh6vt8DhjoGxQ==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Brian Kubisiak <brian@HIDDEN>
Subject: Re: [bug#74633] [PATCH v2] ui: Search channels for guix extensions
In-Reply-To: <2c078699007e847611b7a20679621813691d9db3.1733695255.git.brian@HIDDEN>
 (Brian Kubisiak's message of "Sun, 8 Dec 2024 14:03:45 -0800")
References: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@HIDDEN>
 <2c078699007e847611b7a20679621813691d9db3.1733695255.git.brian@HIDDEN>
Date: Thu, 26 Dec 2024 22:08:52 +0100
Message-ID: <87plle17a3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 74633
Cc: 74633 <at> debbugs.gnu.org, Carlo Zancanaro <carlo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Brian,

Brian Kubisiak <brian@HIDDEN> skribis:

> * 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

Overall LGTM.  I tested it with =E2=80=98make as-derivation=E2=80=99 and it=
 works as
advertised; =E2=80=98strace -c=E2=80=99 shows that the number of syscalls i=
s comparable
to that we currently have.

A couple of minor comments:

> +++ 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)))

This variable is now unused; I think it can be removed.

> +(define add-channels-to-load-path!
> +  (let ((promise
> +         (delay
> +           (let-values (((channels-scm channels-go) (package-path-entrie=
s)))
> +             (set! %load-path
> +                   (append %load-path channels-scm))
> +             (set! %load-compiled-path
> +                   (append %load-compiled-path channels-go))))))
> +    (lambda ()
> +      "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 ev=
en if
> +it is called multiple times."
> +      (force promise))))

For clarity, I would call this =E2=80=98append-channels-to-load-path!=E2=80=
=99.

Using a promise here works, but I find it slightly misleading (because
we=E2=80=99re using it for side effects) and a bit heavyweight (promises are
thread-safe, so there=E2=80=99s a mutex etc.).

How about this:

  (define (append-channels-to-load-path!)
    (let-values (=E2=80=A6)
      =E2=80=A6)
    (set! append-channels-to-load-path! (lambda () #t)))

?

Could you send a v3 along these lines, if you think that makes sense?

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#74633; Package guix-patches. Full text available.

Message received at 74633 <at> debbugs.gnu.org:


Received: (at 74633) by debbugs.gnu.org; 8 Dec 2024 22:03:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 08 17:03:57 2024
Received: from localhost ([127.0.0.1]:51920 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tKPNd-0001zO-0a
	for submit <at> debbugs.gnu.org; Sun, 08 Dec 2024 17:03:57 -0500
Received: from [75.171.110.13] (port=1859 helo=mail.kubisiak.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <brian@HIDDEN>) id 1tKPNa-0001z1-T4
 for 74633 <at> debbugs.gnu.org; Sun, 08 Dec 2024 17:03:55 -0500
dkim-signature: v=1; a=rsa-sha256; d=kubisiak.com; s=s1;
 c=relaxed/relaxed; q=dns/txt;
 h=From:Subject:Date:Message-ID:To:MIME-Version:Content-Type; 
 bh=uTDgIeei+nonM3f78WhRKqXuUHtju5VaSw4vGHPL6ro=;
 b=KKW/SlDkCd1eCzCTFwwWWuQkaW46aMmY+g0J5mrk40rc0fDn2BeM4wB2DO/wBIRCDvEJav/uODAGENHfHzvFHvKU2tBasJY0dNMPk+2KfDQ306UI/NY3ly85FwA4kRM5vRRh3ws5zRGNlTVIhIhWBZd9TN10qFrDkBO8wJHpv1Qa4mQPKsIsINMsIK6pgKTLRHuAAmmPXGogAxnUsaDDozji2eg4c3ZkjZihQIvjW2JCJSKTBWqwuvLEYQ
 /12dr1sZpK3Jtua2zvkqMWFER5mSF/yXHLqwzLm7sy35N0vn9mh6ubiEcjGFyNVhqY/NKuQtndp2YqM0jjKnqbkdxh2g==
Received: from peregrine (135-180-130-213.dsl.dynamic.sonic.net
 [135.180.130.213]) (envelope-sender <brian@HIDDEN>)
 by mail.kubisiak.com with ESMTPSA id
 <2c078699007e847611b7a20679621813691d9db3.1733695255.git.brian@HIDDEN>
 for <74633 <at> debbugs.gnu.org>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256)
 ; Sun, 8 Dec 2024 16:03:46 -0600
Date: Sun, 8 Dec 2024 14:03:45 -0800
From: Brian Kubisiak <brian@HIDDEN>
To: 74633 <at> debbugs.gnu.org
Subject: [PATCH v2] ui: Search channels for guix extensions
Message-ID: <2c078699007e847611b7a20679621813691d9db3.1733695255.git.brian@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: * 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- [...] 
 Content analysis details:   (1.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE:
 The query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [75.171.110.13 listed in sa-accredit.habeas.com]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The
 query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [75.171.110.13 listed in bl.score.senderscore.com]
 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS
X-Debbugs-Envelope-To: 74633
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

* 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 | 17 +++++++++++++++++
 guix/self.scm     |  1 +
 guix/ui.scm       | 12 +++++++++---
 4 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/gnu/packages.scm b/gnu/packages.scm
index 1af3b8d440..42f3546606 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.
+    (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..6694b1eaf7 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,21 @@ (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 ()
+      "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."
+      (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..87ae24ea55 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,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"))))
+  (add-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: 9001514e242ad15c190588439930b0fa4f6782e3
prerequisite-patch-id: cd0707c90e1d321f3f16f2f861313dd330e9f0b4
--
2.46.0





Information forwarded to guix-patches@HIDDEN:
bug#74633; Package guix-patches. Full text available.

Message received at 74633 <at> debbugs.gnu.org:


Received: (at 74633) by debbugs.gnu.org; 5 Dec 2024 04:38:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 04 23:38:47 2024
Received: from localhost ([127.0.0.1]:37703 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tJ3dW-0004ml-Eu
	for submit <at> debbugs.gnu.org; Wed, 04 Dec 2024 23:38:47 -0500
Received: from mail-pg1-f179.google.com ([209.85.215.179]:58849)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <carlo_zancanaro@HIDDEN>) id 1tIzj5-00013J-9r
 for 74633 <at> debbugs.gnu.org; Wed, 04 Dec 2024 19:28:20 -0500
Received: by mail-pg1-f179.google.com with SMTP id
 41be03b00d2f7-7fbc65f6c72so373425a12.1
 for <74633 <at> debbugs.gnu.org>; Wed, 04 Dec 2024 16:28:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sil.org; s=google; t=1733358429; x=1733963229; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=7uFl/3L1Mu4Dtmg5VZAMFK9HOnORoyPS3vh7SCBh+OU=;
 b=ZqlcoGhe5+7A1yyp9BOKX9wZVW3YtQF6MLjATux3948xWxs6fR4YShjhRW21Er6BGi
 jflT9zMQ6sPeeho1bAPQW+9EtbW2ggVNPL0LJIO7RpND5oMhZbz1n+XOvfUxR63xTh6V
 XHSKTSuCgDKGET8j32AEDknxoHAEkkmzPITNA=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1733358429; x=1733963229;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=7uFl/3L1Mu4Dtmg5VZAMFK9HOnORoyPS3vh7SCBh+OU=;
 b=qSuea5WrTkPZ3kLUebpbdpg3Glvh/o/W9lYhSKeKU0U7f69HljPIvU3xsotkEKcVtI
 jKJQgEJtoLE3RmSxF7CwQ9fdXkuGYcU1VyEiul8eTyYugcps+S57zKPPU9rKImUMKmPJ
 wn8IPptWDbQIH5rF3nvA9W5ejG7JqcQM8lB7q+ZL0vGlaqeP/sRcKiTp0h5Qws6kLnEG
 lkpZEz5ONiadf1ty20y61A7uEaykXYg/NhlMv8MBx8cOUPjfKMlj73CrK6FhiMlK1+oS
 ynzt7Pr7LgEcpLPydFwT1uvY81vOOporpNRLZK3afNsLy83Eruxgw+nja3n3UmfXJbOg
 bdYQ==
X-Gm-Message-State: AOJu0YydrTxLRAC4pZq2nqnB5ioLornUx2NCJjW1AovSRw+3zkuC3jQo
 yfLPYdyCCcDENOs+xxJh5MA75iel+uSWW3C6a4Hqb1TVtalk/klteyBJ+kOoSww1mVQ7wpvXH/M
 oWaIi1OeioX+OYBLalPsr2hzKwgrd7Afxql+QiGukSZkRKXKxhabM0mwwUeAuIUK/WM0mtLCYzK
 SgKJV472DaoXQyrbFHwTfpLNwxFpmLqOWc3CsOB+mPBQ==
X-Gm-Gg: ASbGncueLLNN1o6eZEyQDeYhPKHuv3568IkCF0gTX7aP0cxGMavDq4r8b4c8iwkI+et
 VcmdeYAbiKMgv5EIgLWONCqe+C1mJfbd+82q3tdDC7mBMZJMYX02nhlB8Yq/Q2NPqVadOytmNhb
 5d8r+vNcISNKRo5y4rM9fBnfvTcwEl0ljqLE1kAbAiYKubmb1qv+PzGPRAvtaOswnZz+qaU9fe0
 Ip0q2B46P6L185Vdxb4c5/sEmCi0x/IUH8yW/0M3myXOkbi3Pl2cFWqPF7HQ4Fgjk2sUrGQvwuI
 MR1cScb5/fGcx8Srw7e4xThd
X-Google-Smtp-Source: AGHT+IGdqz6c1XVCQUm7X1YN6B8Kx77KdHocXKEN7lotI9Jt6613Z8Qmp89O1E5vqa5dUgkwSaWqyQ==
X-Received: by 2002:a05:6a20:e605:b0:1e0:cd2a:d80a with SMTP id
 adf61e73a8af0-1e1653a05cemr12230324637.7.1733358429256; 
 Wed, 04 Dec 2024 16:27:09 -0800 (PST)
Received: from squirtle (n203-164-246-111.bla21.nsw.optusnet.com.au.
 [203.164.246.111]) by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-725a2ca671asm84260b3a.153.2024.12.04.16.27.07
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 04 Dec 2024 16:27:08 -0800 (PST)
From: Carlo Zancanaro <carlo_zancanaro@HIDDEN>
To: Brian Kubisiak <brian@HIDDEN>
Subject: Re: [bug#74633] [PATCH] ui: Search channels for guix extensions
In-Reply-To: <pfuvhwyvbfi2n3higerccakdnylsv7vbadwjjnzay5sejiot3q@ki6cc4wuwcru>
 (Brian Kubisiak's message of "Tue, 3 Dec 2024 16:59:47 -0800")
References: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@HIDDEN>
 <87mshdknrp.fsf@HIDDEN>
 <pfuvhwyvbfi2n3higerccakdnylsv7vbadwjjnzay5sejiot3q@ki6cc4wuwcru>
Date: Thu, 05 Dec 2024 11:27:05 +1100
Message-ID: <87cyi7q8iu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 74633
X-Mailman-Approved-At: Wed, 04 Dec 2024 23:38:43 -0500
Cc: 74633 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Tue, Dec 03 2024, Brian Kubisiak wrote:
>> That is, if I wanted to add a command "guix foo" I would need to
>> define a module in $channel_dir/guix/extensions/guix/scripts/foo.scm?
>
> This is not required, the command "guix foo" could be defined in
> $channel_dir/guix/extensions/foo.scm. The command-files function
> doesn't add /guix/scripts if a directory is passed as an argument and
>  the run-guix-command function will resolve '(guix extensions foo)
> if foo.scm exists in an extension directory
> (i.e. $channel_dir/guix/extensions/foo.scm exists).

Ah, I see. That sounds good to me.

Given the channel is also being added to %load-path, I expect you can
add a command by defining (guix scripts foo) or (guix extensions foo)
and it will work either way (finding the former first).

We should document this method of extension in the manual. I think a new
section in the "(guix) Channels" chapter for "Declaring Custom Commands"
would be helpful. I might have some time to write something in the next
few days, but if you get a chance before then go ahead.

Thanks for your work on this,

Carlo




Information forwarded to guix-patches@HIDDEN:
bug#74633; Package guix-patches. Full text available.

Message received at 74633 <at> debbugs.gnu.org:


Received: (at 74633) by debbugs.gnu.org; 4 Dec 2024 01:00:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 03 20:00:05 2024
Received: from localhost ([127.0.0.1]:33447 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tIdkJ-0006fs-DQ
	for submit <at> debbugs.gnu.org; Tue, 03 Dec 2024 20:00:05 -0500
Received: from [75.171.110.13] (port=2213 helo=mail.kubisiak.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <brian@HIDDEN>) id 1tIdkG-0006ej-BU
 for 74633 <at> debbugs.gnu.org; Tue, 03 Dec 2024 20:00:01 -0500
dkim-signature: v=1; a=rsa-sha256; d=kubisiak.com; s=s1;
 c=relaxed/relaxed; q=dns/txt;
 h=From:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type:In-Reply-To:References;
 bh=AH6JIRjzi49FCCL0Jpoc4LnKHcf98B+Q5Eavd7H2b94=;
 b=hUzAxFYL9tuK2vx7BdmxZjB4cxcsQXPlphBQYH+b9tfzB1HMa179Dl00mEiFiIteziUNgx0x0jidmjPcZLPsrEY2RFPS9aGKPvzcmdmJ3jbb3gLxLA1QE9e+yHGmIuIb+QVHngFKRASOdYh5inimwYdziGqF1qt0T/XtqiBhmvTttR9v/upJ/F0Y3CC5LYthFvO69xzYobqZe8O74G49nqHU1zBJ/8+LxQtYBgCsDOHDv//d5p/suk2wJL
 Mt2l0xqQ5pbJE/A+786x1kOXbrGucdniEVp6f+/O2OZGJRS9lrKIOApckjGtqYIEwN9NCd5XlgCaVWz6pkIY5Bnd2pxQ==
Received: from peregrine (135-180-130-213.dsl.dynamic.sonic.net
 [135.180.130.213]) (envelope-sender <brian@HIDDEN>)
 by mail.kubisiak.com with ESMTPSA
 id <pfuvhwyvbfi2n3higerccakdnylsv7vbadwjjnzay5sejiot3q@ki6cc4wuwcru>
 for <Undisclosed Recipients>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256)
 ; Tue, 3 Dec 2024 18:59:49 -0600
Date: Tue, 3 Dec 2024 16:59:47 -0800
From: Brian Kubisiak <brian@HIDDEN>
To: Carlo Zancanaro <carlo@HIDDEN>
Subject: Re: [bug#74633] [PATCH] ui: Search channels for guix extensions
Message-ID: <pfuvhwyvbfi2n3higerccakdnylsv7vbadwjjnzay5sejiot3q@ki6cc4wuwcru>
References: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@HIDDEN>
 <87mshdknrp.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87mshdknrp.fsf@HIDDEN>
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Hi Carlo, > On Sun, Dec 01 2024, Brian Kubisiak wrote: > >
 diff --git a/gnu/packages.scm b/gnu/packages.scm > > index
 80c22d1d7f..05b8bf8e6d
 100644 > > --- a/gnu/packages.scm > > +++ b/gnu/packages.scm > > @@ - [...]
 Content analysis details:   (1.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE:
 The query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [75.171.110.13 listed in sa-trusted.bondedsender.org]
 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The
 query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [75.171.110.13 listed in bl.score.senderscore.com]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS
X-Debbugs-Envelope-To: 74633
Cc: 74633 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

Hi Carlo,

> On Sun, Dec 01 2024, Brian Kubisiak wrote:
> > 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.
>
> This comment should be moved onto add-channels-to-load-path!. Possibly
> even as a docstring.

Will do.

> > 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)
>
> I don't know enough to know if this is a problem, but it's a shame to
> have to add this, given I don't think this change actually ends up using
> any git functionality.

Honestly I'm not sure what the are the downsides of this, since I
don't see how *core-module* would get used without *extra-modules* or
why *core-modules* doesn't include all the dependencies. Maybe Ludo
knows more?

> > diff --git a/guix/ui.scm b/guix/ui.scm
> > index eba12c8616..28690b22bc 100644
> > --- a/guix/ui.scm
> > +++ b/guix/ui.scm
> > @@ -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)))))
>
> I don't think you need the (append ...). According to the manual,
> parse-path takes another argument as a "tail" for the resulting list, so
> (parse-path (getenv "GUIX_EXTENSIONS_PATH") (map ... channels)) should
> be enough here.

I saw that on your patch, good to know!

> Am I right in thinking that this will look inside the channels at
> /guix/extensions to try to find things?

Correct. I chose this to match existing behavior, since
$GUIX_EXTENSIONS_PATH points at this directory for an extension
installed as a package. (I was able to tkae an existing extension and
pull it in as a channel and everything "just worked" without changing
any code or directory structure in the extension)

> That is, if I wanted to add a command "guix foo" I would need to
> define a module in $channel_dir/guix/extensions/guix/scripts/foo.scm?

This is not required, the command "guix foo" could be defined in
$channel_dir/guix/extensions/foo.scm. The command-files function
doesn't add /guix/scripts if a directory is passed as an argument and
 the run-guix-command function will resolve '(guix extensions foo)
if foo.scm exists in an extension directory
(i.e. $channel_dir/guix/extensions/foo.scm exists).

Thanks for the feedback,
Brian





Information forwarded to guix-patches@HIDDEN:
bug#74633; Package guix-patches. Full text available.

Message received at 74633 <at> debbugs.gnu.org:


Received: (at 74633) by debbugs.gnu.org; 3 Dec 2024 11:30:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 03 06:29:59 2024
Received: from localhost ([127.0.0.1]:58447 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tIR6N-0000Yy-9g
	for submit <at> debbugs.gnu.org; Tue, 03 Dec 2024 06:29:59 -0500
Received: from voltorb.zancanaro.id.au ([45.77.50.64]:54190)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <carlo@HIDDEN>) id 1tIR6K-0000Ye-Nx
 for 74633 <at> debbugs.gnu.org; Tue, 03 Dec 2024 06:29:58 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=k1; bh=wThLffGQysgTKYt
 oJD5NB+dPBNaE9aWpUVHJlIcSxCE=;
 h=date:references:in-reply-to:subject:
 cc:to:from; d=zancanaro.id.au; b=nSFbjENGtTcwsYn+Bna0iS7i0ftTc9BYOYUCM
 qL1ku7P4/+JB6pRtlSzU/NfXAFT00U1J2CBPM846vadO4/gaH45aJ/cbpzftg+qZuoHN4r
 8SUmCfrotIfRgySLGq2BrkgC/wUMIGofO9s95FD2Q7RAx7HOrEkeX+qBq7VChPsk=
Received: by voltorb.zancanaro.id.au (OpenSMTPD) with ESMTPSA id 8d4ae4dc
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Tue, 3 Dec 2024 11:29:06 +0000 (UTC)
From: Carlo Zancanaro <carlo@HIDDEN>
To: Brian Kubisiak <brian@HIDDEN>
Subject: Re: [bug#74633] [PATCH] ui: Search channels for guix extensions
In-Reply-To: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@HIDDEN>
 (Brian Kubisiak's message of "Sun, 1 Dec 2024 06:53:03 -0800")
References: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@HIDDEN>
Date: Tue, 03 Dec 2024 22:29:46 +1100
Message-ID: <87mshdknrp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 74633
Cc: 74633 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Brian!

As Ludo mentioned, I've recently sent a patch to solve the same problem,
but mine is a bit different. I think your change is better in most ways
to mine, but I'll comment on some things inline below.

On Sun, Dec 01 2024, Brian Kubisiak wrote:
> 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.

This comment should be moved onto add-channels-to-load-path!. Possibly
even as a docstring.

> diff --git a/guix/describe.scm b/guix/describe.scm
> index a4ca2462f4..3bbda15db5 100644
> --- a/guix/describe.scm
> +++ b/guix/describe.scm
> @@ -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))))

I like that this is avoiding adding things to the path multiple times
(which is a problem with my proposed change).

> 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)

I don't know enough to know if this is a problem, but it's a shame to
have to add this, given I don't think this change actually ends up using
any git functionality.

I solved the same issue by lazily resolving the (guix describe) module.
Using an autoload wasn't enough (i.e. it still broke "guix pull"), but
using (@ (guix describe) package-path-entries) worked.

> diff --git a/guix/ui.scm b/guix/ui.scm
> index eba12c8616..28690b22bc 100644
> --- a/guix/ui.scm
> +++ b/guix/ui.scm
> @@ -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)))))

I don't think you need the (append ...). According to the manual,
parse-path takes another argument as a "tail" for the resulting list, so
(parse-path (getenv "GUIX_EXTENSIONS_PATH") (map ... channels)) should
be enough here.

Am I right in thinking that this will look inside the channels at
/guix/extensions to try to find things? That is, if I wanted to add a
command "guix foo" I would need to define a module in
$channel_dir/guix/extensions/guix/scripts/foo.scm?

If I'm reading that correctly, this feels unnecessary. Channels can
already specify a directory in their .guix-channel file. In my change it
just looks for $channel_dir/guix/scripts/foo.scm, which seems more
straightforward. (I'm not worried about people accidentally defining
something /guix/scripts/, because the name is pretty obvious.)

All together, I'm proposing simplifying things to:

--8<---------------cut here---------------start------------->8---
(define (extension-directories)
  "Return the list of directories containing Guix extensions."
  (add-channels-to-load-path!)
  (let ((channels (package-path-entries)))
    (filter file-exists?
            (parse-path (getenv "GUIX_EXTENSIONS_PATH") channels))))
--8<---------------cut here---------------end--------------->8---

We may also want to something into the docstring to mention that it adds
to %load-path.

Carlo




Information forwarded to guix-patches@HIDDEN:
bug#74633; Package guix-patches. Full text available.

Message received at 74633 <at> debbugs.gnu.org:


Received: (at 74633) by debbugs.gnu.org; 2 Dec 2024 17:28:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 02 12:28:11 2024
Received: from localhost ([127.0.0.1]:56432 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tIADT-0004xe-A5
	for submit <at> debbugs.gnu.org; Mon, 02 Dec 2024 12:28:11 -0500
Received: from eggs.gnu.org ([209.51.188.92]:36026)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1tIADQ-0004xF-3w
 for 74633 <at> debbugs.gnu.org; Mon, 02 Dec 2024 12:28:09 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1tIABD-0000RP-K0; Mon, 02 Dec 2024 12:25:51 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=dSOxIbbI5thGU/n+AyHqdq+wv/SyAwimJ6faa6SlRfw=; b=Tg7GVhYtOEqG42mJbwGj
 Hx15ZPB/f3aao0YwsuV2Zu3z1nmYGnscnms03Al9VHiALWpvd2igUcrdXKaEqACjACRumlW3bFytn
 0so54/ztiaodFhMQYcFXHEzOsbd8CDiLCNspGJFUeQpx8TYLluLLy0GEKg46Ynk2IKVMc2fg9p96C
 5ser+A2wJctFx37T5NQmSqL8mrMb9eLrl9M98qJT+x420GG1KkT+4Wkw+6QieHCTyfzMnOpaPcIrE
 wr3GH+6BwUyBMxoVDzfCnZFNOBB/LM19rpG1ORWhjefkfVKytFfPfGnmEbLH1IGcmWfLghywAeeDE
 VdaIoOWmPFXFRw==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Brian Kubisiak <brian@HIDDEN>
Subject: Re: [bug#74633] [PATCH] ui: Search channels for guix extensions
In-Reply-To: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@HIDDEN>
 (Brian Kubisiak's message of "Sun, 1 Dec 2024 06:53:03 -0800")
References: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@HIDDEN>
Date: Mon, 02 Dec 2024 18:25:43 +0100
Message-ID: <87frn63sko.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 74633
Cc: 74633 <at> debbugs.gnu.org, Carlo Zancanaro <carlo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hello,

Brian Kubisiak <brian@HIDDEN> skribis:

> * 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

Before looking further, note that Carlo (Cc=E2=80=99d) has been looking into
this as well:

  https://issues.guix.gnu.org/74425

So there=E2=80=99s a real need :-) and perhaps ways both can be merged.

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#74633; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Dec 2024 14:53:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 01 09:53:11 2024
Received: from localhost ([127.0.0.1]:50819 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tHlJv-0005Py-FL
	for submit <at> debbugs.gnu.org; Sun, 01 Dec 2024 09:53:11 -0500
Received: from lists.gnu.org ([209.51.188.17]:49714)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <brian@HIDDEN>) id 1tHlJt-0005Pr-RH
 for submit <at> debbugs.gnu.org; Sun, 01 Dec 2024 09:53:10 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <brian@HIDDEN>)
 id 1tHlJt-0007Qy-Eq
 for guix-patches@HIDDEN; Sun, 01 Dec 2024 09:53:09 -0500
Received: from [75.171.110.13] (helo=mail.kubisiak.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <brian@HIDDEN>)
 id 1tHlJr-0008S9-KO
 for guix-patches@HIDDEN; Sun, 01 Dec 2024 09:53:09 -0500
dkim-signature: v=1; a=rsa-sha256; d=kubisiak.com; s=s1;
 c=relaxed/relaxed; q=dns/txt;
 h=From:Subject:Date:Message-ID:To:MIME-Version:Content-Type; 
 bh=nrO2vr/Pk5PuR7Kjx3xqqcaJLkGHlwfbG8PtNeOprIU=;
 b=HbnQkUjCELP/q+pPQOpqyPxe7MrYt2Oka7xD5wOJQQv5I6VTmqt3Maq9VyrXcUdnTfDVc5lyYZBx6cm0ntJsUaP6IC5x0fKHBnjNu3RCu5WL30jD77AQqbCgnJx9XkQACtwa8pVu/lCc+YZczj1UA/4XnTFDNNgH6Lpq0QpcY2DGE5+bKzRvZZxmjvoGvQuRKkbMvk4TypPAlPQXhMsL6plg2cyQSCU1wKgxXb4YOEBnaotaDDrNXPlnNo
 pBnj4DmaWWDB992fPVA9lzVZ49suI77wWKRLXSZLxS7Ke81MD+kOuTyg5RiCjKGuIsHf/6+g/CW2WMxjeAVWmEdZoIwg==
Received: from peregrine (135-180-130-213.dsl.dynamic.sonic.net
 [135.180.130.213]) (envelope-sender <brian@HIDDEN>)
 by mail.kubisiak.com with ESMTPSA id
 <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@HIDDEN>
 for <guix-patches@HIDDEN>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256)
 ; Sun, 1 Dec 2024 08:53:04 -0600
Date: Sun, 1 Dec 2024 06:53:03 -0800
From: Brian Kubisiak <brian@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] ui: Search channels for guix extensions
Message-ID: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Host-Lookup-Failed: Reverse DNS lookup failed for 75.171.110.13 (failed)
Received-SPF: pass client-ip=75.171.110.13; envelope-from=brian@HIDDEN;
 helo=mail.kubisiak.com
X-Spam_score_int: -12
X-Spam_score: -1.3
X-Spam_bar: -
X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 RDNS_NONE=0.793, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

* 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






Acknowledgement sent to Brian Kubisiak <brian@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#74633; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

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