GNU bug report logs - #57317
[PATCH 0/2] Implicitly set GUIX_EXTENSIONS_PATH in profiles.

Previous Next

Package: guix-patches;

Reported by: "(" <paren <at> disroot.org>

Date: Sun, 21 Aug 2022 13:14:02 UTC

Severity: normal

Tags: patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57317 in the body.
You can then email your comments to 57317 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#57317; Package guix-patches. (Sun, 21 Aug 2022 13:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "(" <paren <at> disroot.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 21 Aug 2022 13:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: guix-patches <at> gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: [PATCH 0/2] Implicitly set GUIX_EXTENSIONS_PATH in profiles.
Date: Sun, 21 Aug 2022 14:12:22 +0100
Hi Guix!

This patchset allows Guix to automatically find extensions installed
in profiles. There's probably a more elegant way to do this, but this
is the simplest and easiest way I can think of.

( (2):
  build: profiles: Always set GUIX_EXTENSIONS_PATH.
  gnu: package-management: Remove mentions of GUIX_EXTENSIONS_PATH.

 gnu/packages/package-management.scm | 11 +----------
 guix/build/profiles.scm             |  4 ++++
 2 files changed, 5 insertions(+), 10 deletions(-)

-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57317; Package guix-patches. (Sun, 21 Aug 2022 13:17:01 GMT) Full text and rfc822 format available.

Message #8 received at 57317 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: 57317 <at> debbugs.gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: [PATCH 1/2] build: profiles: Always set GUIX_EXTENSIONS_PATH.
Date: Sun, 21 Aug 2022 14:16:27 +0100
* guix/build/profiles.scm (build-etc/profile): Implicitly set
  GUIX_EXTENSIONS_PATH to ${GUIX_PROFILE}/share/guix/extensions.

This allows Guix to find extensions without any need for users to
set GUIX_EXTENSIONS_PATH manually.
---
 guix/build/profiles.scm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/guix/build/profiles.scm b/guix/build/profiles.scm
index 0c92f222b4..f8b2e72d9c 100644
--- a/guix/build/profiles.scm
+++ b/guix/build/profiles.scm
@@ -97,6 +97,10 @@ (define file
 # When GUIX_PROFILE is undefined, the various environment variables refer
 # to this specific profile generation.
 \n" port)
+      (format port "~a~%" (environment-variable-definition
+                           "GUIX_EXTENSIONS_PATH"
+                           (string-append output "/share/guix/extensions")
+                           #:kind 'prefix))
       (let ((variables (evaluate-search-paths search-paths
                                               (list output))))
         (for-each (write-environment-variable-definition port)
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57317; Package guix-patches. (Sun, 21 Aug 2022 13:17:02 GMT) Full text and rfc822 format available.

Message #11 received at 57317 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: 57317 <at> debbugs.gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: [PATCH 2/2] gnu: package-management: Remove mentions of
 GUIX_EXTENSIONS_PATH.
Date: Sun, 21 Aug 2022 14:16:28 +0100
* gnu/packages/package-management.scm (guix-modules)[description]:
  Remove instructions to set GUIX_EXTENSIONS_PATH.
---
 gnu/packages/package-management.scm | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 0469c73ff5..a4b0905b1b 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -726,16 +726,7 @@ (define-public guix-modules
 module} command.  The @command{guix module create} sub-command creates
 @dfn{environment modules}, allowing you to manipulate software environments
 with the @command{module} command commonly found on @acronym{HPC,
-high-performance computing} clusters.
-
-To use this extension, set the @env{GUIX_EXTENSIONS_PATH} environment
-variable, along these lines:
-
-@example
-export GUIX_EXTENSIONS_PATH=\"$HOME/.guix-profile/share/guix/extensions\"
-@end example
-
-Replace @code{$HOME/.guix-profile} with the appropriate profile.")
+high-performance computing} clusters.")
     (license license:gpl3+)))
 
 
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57317; Package guix-patches. (Sun, 21 Aug 2022 15:45:02 GMT) Full text and rfc822 format available.

Message #14 received at 57317 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: 57317 <at> debbugs.gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: [PATCH v2 2/2] gnu: package-management: Remove mentions of
 GUIX_EXTENSIONS_PATH.
Date: Sun, 21 Aug 2022 16:43:49 +0100
* gnu/packages/package-management.scm (guix)[native-search-paths]:
  Remove GUIX_EXTENSIONS_PATH.
(guix-modules)[description]: Remove instructions to set
GUIX_EXTENSIONS_PATH.
---
 gnu/packages/package-management.scm | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 0469c73ff5..ec133a15dd 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -477,10 +477,7 @@ (define code
          ("guile-lzlib" ,guile-lzlib)
          ("guile-zstd" ,guile-zstd)))
       (native-search-paths
-       (list (search-path-specification
-              (variable "GUIX_EXTENSIONS_PATH")
-              (files '("share/guix/extensions")))
-             ;; (guix git) and (guix build download) honor this variable whose
+       (list ;; (guix git) and (guix build download) honor this variable whose
              ;; name comes from OpenSSL.
              $SSL_CERT_DIR))
       (home-page "https://www.gnu.org/software/guix/")
@@ -726,16 +723,7 @@ (define-public guix-modules
 module} command.  The @command{guix module create} sub-command creates
 @dfn{environment modules}, allowing you to manipulate software environments
 with the @command{module} command commonly found on @acronym{HPC,
-high-performance computing} clusters.
-
-To use this extension, set the @env{GUIX_EXTENSIONS_PATH} environment
-variable, along these lines:
-
-@example
-export GUIX_EXTENSIONS_PATH=\"$HOME/.guix-profile/share/guix/extensions\"
-@end example
-
-Replace @code{$HOME/.guix-profile} with the appropriate profile.")
+high-performance computing} clusters.")
     (license license:gpl3+)))
 
 
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57317; Package guix-patches. (Sun, 21 Aug 2022 15:45:02 GMT) Full text and rfc822 format available.

Message #17 received at 57317 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: 57317 <at> debbugs.gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: [PATCH v2 1/2] build: profiles: Implicitly set GUIX_EXTENSIONS_PATH.
Date: Sun, 21 Aug 2022 16:43:48 +0100
* guix/build/profiles.scm (manifest-sexp->inputs+search-paths):
  Always return a search path for GUIX_EXTENSIONS_PATH.
* guix/search-paths.scm ($GUIX_EXTENSIONS_PATH): New variable.

This allows Guix to find extensions without any need for users to
set GUIX_EXTENSIONS_PATH manually.
---
 guix/build/profiles.scm |  7 ++++---
 guix/search-paths.scm   | 11 +++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/guix/build/profiles.scm b/guix/build/profiles.scm
index 0c92f222b4..b19d93f971 100644
--- a/guix/build/profiles.scm
+++ b/guix/build/profiles.scm
@@ -179,9 +179,10 @@ (define-syntax let-fields
          (()
           (values (reverse inputs)
                   (delete-duplicates
-                   (cons $PATH
-                         (map sexp->search-path-specification
-                              (reverse search-paths)))))))))))
+                   (cons* $PATH
+                          $GUIX_EXTENSIONS_PATH
+                          (map sexp->search-path-specification
+                               (reverse search-paths)))))))))))
 
 (define* (build-profile output manifest
                         #:key (extra-inputs '()) (symlink symlink))
diff --git a/guix/search-paths.scm b/guix/search-paths.scm
index 6b13a98946..5a0cddac8f 100644
--- a/guix/search-paths.scm
+++ b/guix/search-paths.scm
@@ -33,6 +33,7 @@ (define-module (guix search-paths)
             search-path-specification-file-pattern
 
             $PATH
+            $GUIX_EXTENSIONS_PATH
             $SSL_CERT_DIR
             $SSL_CERT_FILE
 
@@ -73,6 +74,16 @@ (define $PATH
    (variable "PATH")
    (files '("bin" "sbin"))))
 
+(define-public $GUIX_EXTENSIONS_PATH
+  ;; 'GUIX_EXTENSIONS_PATH' is used by Guix to locate extension commands.
+  ;; Like 'PATH', it's not attached to any package, so that users don't have
+  ;; to install the 'guix' package (which is not supposed to be installed,
+  ;; as it will mess up the 'guix pull' installation) or set the variable
+  ;; manually.
+  (search-path-specification
+   (variable "GUIX_EXTENSIONS_PATH")
+   (files '("share/guix/extensions"))))
+
 ;; Two variables for certificates (see (guix)X.509 Certificates),
 ;; respected by 'openssl', possibly GnuTLS in the future
 ;; (https://gitlab.com/gnutls/gnutls/-/merge_requests/1541)
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57317; Package guix-patches. (Sun, 21 Aug 2022 19:39:02 GMT) Full text and rfc822 format available.

Message #20 received at 57317 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: "(" <paren <at> disroot.org>, 57317 <at> debbugs.gnu.org
Subject: Re: [bug#57317] [PATCH v2 1/2] build: profiles: Implicitly set
 GUIX_EXTENSIONS_PATH.
Date: Sun, 21 Aug 2022 21:38:09 +0200
[Message part 1 (text/plain, inline)]
On 21-08-2022 17:43, ( via Guix-patches via wrote:

>   
> +(define-public $GUIX_EXTENSIONS_PATH
> +  ;; 'GUIX_EXTENSIONS_PATH' is used by Guix to locate extension commands.
> +  ;; Like 'PATH', it's not attached to any package, so that users don't have
> +  ;; to install the 'guix' package (which is not supposed to be installed,
> +  ;; as it will mess up the 'guix pull' installation) or set the variable
> +  ;; manually.
> +  (search-path-specification
> +   (variable "GUIX_EXTENSIONS_PATH")
> +   (files '("share/guix/extensions"))))

I have in the past proposed to add more implicit search paths 
(GUIX_LOCPATH, SSL_CERT_DIR and SSL_CERT_FILE), but that had been rejected.

v1 -> v2 1/2: looks a good change to me.

Greetings,
Maxime.

[OpenPGP_0x49E3EE22191725EE.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#57317; Package guix-patches. (Sun, 21 Aug 2022 19:47:02 GMT) Full text and rfc822 format available.

Message #23 received at 57317 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: 57317 <at> debbugs.gnu.org
Cc: GNU Guix maintainers <guix-maintainers <at> gnu.org>
Subject: [PATCH 0/2] Implicitly set GUIX_EXTENSIONS_PATH in profiles.
Date: Sun, 21 Aug 2022 21:41:41 +0200
I agree with Maxime: this looks good, and I also think that other
variables could be set unconditionally.

Yes, it’s a little inelegant to set environment variables like this, but
for GUIX_EXTENSIONS_PATH I think it’s warranted, because Guix is special
anyway.

So +1 from me.

I’m CC’ing the maintainers to perhaps get a comment on the general
approach for the record.

-- 
Ricardo




Information forwarded to guix-patches <at> gnu.org:
bug#57317; Package guix-patches. (Mon, 22 Aug 2022 09:25:02 GMT) Full text and rfc822 format available.

Message #26 received at 57317 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 57317 <at> debbugs.gnu.org, GNU Guix maintainers <guix-maintainers <at> gnu.org>
Subject: Re: [bug#57317] [PATCH 0/2] Implicitly set GUIX_EXTENSIONS_PATH in
 profiles.
Date: Mon, 22 Aug 2022 12:20:35 +0300
[Message part 1 (text/plain, inline)]
On Sun, Aug 21, 2022 at 09:41:41PM +0200, Ricardo Wurmus wrote:
> I agree with Maxime: this looks good, and I also think that other
> variables could be set unconditionally.
> 
> Yes, it’s a little inelegant to set environment variables like this, but
> for GUIX_EXTENSIONS_PATH I think it’s warranted, because Guix is special
> anyway.
> 
> So +1 from me.
> 
> I’m CC’ing the maintainers to perhaps get a comment on the general
> approach for the record.
> 

Not with my maintainer hat on:

I tried to create an extension a while ago and it wasn't entirely clear
to me how to force loading extensions correctly when testing from a guix
environment.

By removing the notes about setting GUIX_EXTENSION_PATH to
~/.guix-profile/... we allow Guix to use actual search paths like we do
with other environment variables so we can use it with guix-home or
other alternate profiles, such as the OS config.


I took a minute to look at my extension; I had to set
GUIX_EXTENSION_PATH to an absolute location, not a relative one.

Normally we'd tell people they have to install a package to make use of
it's search paths, like reminding people to add python to their shell
invocation, not just python-pip. In this case we DON'T want people
installing the guix package, so we need to make the environment variable
available another way.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Reply sent to Efraim Flashner <efraim <at> flashner.co.il>:
You have taken responsibility. (Wed, 07 Sep 2022 08:47:02 GMT) Full text and rfc822 format available.

Notification sent to "(" <paren <at> disroot.org>:
bug acknowledged by developer. (Wed, 07 Sep 2022 08:47:02 GMT) Full text and rfc822 format available.

Message #31 received at 57317-done <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: "(" <paren <at> disroot.org>
Cc: 57317-done <at> debbugs.gnu.org
Subject: Re: [bug#57317] [PATCH 0/2] Implicitly set GUIX_EXTENSIONS_PATH in
 profiles.
Date: Wed, 7 Sep 2022 11:46:00 +0300
[Message part 1 (text/plain, inline)]
On Sun, Aug 21, 2022 at 02:12:22PM +0100, ( via Guix-patches via wrote:
> Hi Guix!
> 
> This patchset allows Guix to automatically find extensions installed
> in profiles. There's probably a more elegant way to do this, but this
> is the simplest and easiest way I can think of.
> 
> ( (2):
>   build: profiles: Always set GUIX_EXTENSIONS_PATH.
>   gnu: package-management: Remove mentions of GUIX_EXTENSIONS_PATH.
> 
>  gnu/packages/package-management.scm | 11 +----------
>  guix/build/profiles.scm             |  4 ++++
>  2 files changed, 5 insertions(+), 10 deletions(-)
> 

I pushed the first patch from the second set to always set
GUIX_EXTENSIONS_PATH and the second patch from the first set, which only
modifies guix-modules but not the guix package itself. I'm pretty sure
that Guix still needs the search path for the extensions.

As a side note, should something be added to guix shell/environment  so
it finds the extensions too?

Thanks for the patches! Now it should be easier to add extensions.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 05 Oct 2022 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 203 days ago.

Previous Next


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