mbox series

[bug#57317,0/2] Implicitly set GUIX_EXTENSIONS_PATH in profiles.

Message ID 20220821131222.12411-1-paren@disroot.org
Headers show
Series Implicitly set GUIX_EXTENSIONS_PATH in profiles. | expand

Message

\( Aug. 21, 2022, 1:12 p.m. UTC
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(-)

Comments

Ricardo Wurmus Aug. 21, 2022, 7:41 p.m. UTC | #1
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.
Efraim Flashner Aug. 22, 2022, 9:20 a.m. UTC | #2
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 Sept. 7, 2022, 8:46 a.m. UTC | #3
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.