[PATCH 0/2] Implicitly set GUIX_EXTENSIONS_PATH in profiles.

  • Done
  • quality assurance status badge
Details
4 participants
  • Efraim Flashner
  • Maxime Devos
  • (
  • Ricardo Wurmus
Owner
unassigned
Submitted by
(
Severity
normal
(
(address . guix-patches@gnu.org)(name . ()(address . paren@disroot.org)
20220821131222.12411-1-paren@disroot.org
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
(
[PATCH 1/2] build: profiles: Always set GUIX_EXTENSIONS_PATH.
(address . 57317@debbugs.gnu.org)(name . ()(address . paren@disroot.org)
20220821131628.12592-1-paren@disroot.org
* 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(+)

Toggle diff (17 lines)
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
(
[PATCH 2/2] gnu: package-management: Remove mentions of GUIX_EXTENSIONS_PATH.
(address . 57317@debbugs.gnu.org)(name . ()(address . paren@disroot.org)
20220821131628.12592-2-paren@disroot.org
* 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(-)

Toggle diff (24 lines)
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
(
[PATCH v2 2/2] gnu: package-management: Remove mentions of GUIX_EXTENSIONS_PATH.
(address . 57317@debbugs.gnu.org)(name . ()(address . paren@disroot.org)
20220821154349.22575-2-paren@disroot.org
* 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(-)

Toggle diff (36 lines)
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
(
[PATCH v2 1/2] build: profiles: Implicitly set GUIX_EXTENSIONS_PATH.
(address . 57317@debbugs.gnu.org)(name . ()(address . paren@disroot.org)
20220821154349.22575-1-paren@disroot.org
* 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(-)

Toggle diff (49 lines)
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
M
M
Maxime Devos wrote on 21 Aug 2022 21:38
4b1e429e-2952-22e5-0e25-78ebbdac5422@telenet.be
On 21-08-2022 17:43, ( via Guix-patches via wrote:
Toggle quote (10 lines)
>
> +(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.
Attachment: OpenPGP_signature
R
R
Ricardo Wurmus wrote on 21 Aug 2022 21:41
[PATCH 0/2] Implicitly set GUIX_EXTENSIONS_PATH in profiles.
(address . 57317@debbugs.gnu.org)(name . GNU Guix maintainers)(address . guix-maintainers@gnu.org)
87v8ql1itz.fsf@elephly.net
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
E
E
Efraim Flashner wrote on 22 Aug 2022 11:20
(name . Ricardo Wurmus)(address . rekado@elephly.net)
YwNKYzFycw/HIDMN@3900XT
On Sun, Aug 21, 2022 at 09:41:41PM +0200, Ricardo Wurmus wrote:
Toggle quote (13 lines)
> 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@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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmMDSmAACgkQQarn3Mo9
g1GuixAAkut6lKv7iBMTCG75mtzWLcQgiZ4pyG2RlHynkmpwwY22gk/FOa/98AXz
D0XO3vMr3tM8KIl5akEP/ASKsp2vEdRDyKVRQNk5o3PCKNk+MjJnWqbLPc2K7GSt
RxrEFQOjm0+T0eyo326ddHoRe0TfCPbk/WeZY/m28E+OxckWoCqc8LclLE4JCu3J
r1XsI/+N1fDM6nk7o0/HJ9W0e+3RB2cSZprc9hu4nIt2iSSFhrcEH3iHF+lD6ceg
ff9UPN2RIfzYbTOTS4gx1Fw47Yp8M6MmvTICr6WS8eQSfuse8iyq7bV83k1MniLT
3vZbA8CvxAa1irtvGRo7tEUmDE6atam1Oaauu67gC9zyoYlN70m9BtEPUzK0Y+LZ
tqftWk8YhOObG8KFcVcbZiGryGvGpfv8MptHQfVZwxl8FOqarXPCRaSfeawpFx6R
wAkYdt6L45XPzapdtx7Iu8iwUvWDlQhqSKUP0BZCAwXzEt843taDZc1OI/Ot7ywQ
6VfTUCiMnQNMqGv0ZHXWQE2w91e7DdK3aZrquL9uo3L7ZeyODlLsTsTem2yEgWx2
RQNEwvvtcLR4Uhmfti+gUBWxc1qtThfu3HWVv1FuZOXF0AAiNY4SkVse82Zxr4E4
k7/Kj5dnG7NJyh1NlRwIrAX1f7F8yErKqGjNhX6NVYQtRdRezvU=
=F2cL
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 7 Sep 2022 10:46
(name . ()(address . paren@disroot.org)(address . 57317-done@debbugs.gnu.org)
YxhaSAtT8L/V4veW@3900XT
On Sun, Aug 21, 2022 at 02:12:22PM +0100, ( via Guix-patches via wrote:
Toggle quote (15 lines)
> 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@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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmMYWkgACgkQQarn3Mo9
g1H9dg//QLHWbclQ4V3QYsti1YLFmxRvfPJIACXHgBb5uaJ3CivT2tkyn/1Ha/ol
IiHu05TpycVFmlYg1dFupIvslzgUaWNFV5SN/7hDQkf7/zcygjfAPGsKzVeCF5/i
yptJa7zafTdeCICULVpa9WPs+3fWpj0GquxI0PgvgiLyhZB/cTek5qOG37K+zX9z
Af73bta2/yst0sEtCcFGM0AScgl5z2bI4UcAMN9Cw6pCf9faLMGJv8K1ZRYSUlAB
v21TD1J2pgRSjn1JfG1hv2agCXdzKGfnr5Nr8Wqn9zY3ftg3GiOa/9Of0DILNksq
UwLyuojhxXmn4WNRG0M5MlNr0PTeDmd5Yqee3o1lEkd+PjSuGHt8iGuVYt87c6jH
YI1tWb77h0SZfBfmu0hrl9EIBW7C5HUZLwUOhc8xQEjHcs+cy+M0LCmhSOMA7XRv
WPwpEIYOTJI51Mdbq+rtXFx02+RCRGpSubPlfGZvFbrI9kxL4a8qptXtSeGK6AL1
Nr+LcFahHy0sdelXAeDOingm2J7iRyEEjQazyOgzS1+PI0Xv1bpyeggAU7NX0qa3
ujgAG8UPJWZ6A2g4epAJmsoFQz6sMfO24lZJFvGrfsaTf4Cpdqj6HGriNBAPyXhS
fsIWsoOXq3zrPElliXFXvSjeM7oFgTfDownQhWRuVwjbcFp5J1Y=
=allS
-----END PGP SIGNATURE-----


Closed
?