all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Eliminate environment variable hints?
@ 2019-02-18 21:56 Ricardo Wurmus
  2019-02-18 22:02 ` Brett Gilio
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Ricardo Wurmus @ 2019-02-18 21:56 UTC (permalink / raw)
  To: guix-devel

Hi Guix,

when installing a package into a profile Guix very helpfully tells you
that you may need to set certain environment variables.  It doesn’t tell
you that these environment variables can also be set by source’ing the
generated etc/profile file.

I have seen the bashrc and bash_profile files of many users and they are
usually full of conflicting environment variable definitions.  In these
files I often also see these Guix recommendations.

I think Guix should suggest sourcing the generated etc/profile file
instead of listing explicit environment variable definitions.  It would
be less noisy and less confusing, in my opinion.

What do you think?

(What about people who don’t use Bash?)

--
Ricardo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-02-18 21:56 Eliminate environment variable hints? Ricardo Wurmus
@ 2019-02-18 22:02 ` Brett Gilio
  2019-02-18 22:08 ` Pierre Neidhardt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Brett Gilio @ 2019-02-18 22:02 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel


Ricardo Wurmus writes:

> Hi Guix,
>
> when installing a package into a profile Guix very helpfully tells you
> that you may need to set certain environment variables.  It doesn’t tell
> you that these environment variables can also be set by source’ing the
> generated etc/profile file.
>
> I have seen the bashrc and bash_profile files of many users and they are
> usually full of conflicting environment variable definitions.  In these
> files I often also see these Guix recommendations.
>
> I think Guix should suggest sourcing the generated etc/profile file
> instead of listing explicit environment variable definitions.  It would
> be less noisy and less confusing, in my opinion.
>
> What do you think?
>
> (What about people who don’t use Bash?)

I think this is a good idea. It may also be worth mentioning that these
suggestions can also be set in environments using the --search-paths
flag. I know that is said in the documentation, but maybe it could be
highlighted somehow?

Brett Gilio

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-02-18 21:56 Eliminate environment variable hints? Ricardo Wurmus
  2019-02-18 22:02 ` Brett Gilio
@ 2019-02-18 22:08 ` Pierre Neidhardt
  2019-02-18 22:18 ` Andreas Enge
  2019-03-04 21:56 ` Ludovic Courtès
  3 siblings, 0 replies; 16+ messages in thread
From: Pierre Neidhardt @ 2019-02-18 22:08 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

Agreed.

For users using other shells, the issue is not knew.

The main recommendation I've seen (e.g. for Fish) is that the user kept a
POSIX-style shell as a login shell and only drop into the desired shell after
the profile has been loaded.  This way, Guix and similar configurations
(/etc/profile, etc.)  can be sourced properly.

See here:
https://wiki.archlinux.org/index.php/Fish#Setting_fish_as_default_shell

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-02-18 21:56 Eliminate environment variable hints? Ricardo Wurmus
  2019-02-18 22:02 ` Brett Gilio
  2019-02-18 22:08 ` Pierre Neidhardt
@ 2019-02-18 22:18 ` Andreas Enge
  2019-02-19  7:41   ` Ricardo Wurmus
  2019-02-19  9:17   ` Pjotr Prins
  2019-03-04 21:56 ` Ludovic Courtès
  3 siblings, 2 replies; 16+ messages in thread
From: Andreas Enge @ 2019-02-18 22:18 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hello,

On Mon, Feb 18, 2019 at 10:56:13PM +0100, Ricardo Wurmus wrote:
> when installing a package into a profile Guix very helpfully tells you
> that you may need to set certain environment variables.  It doesn’t tell
> you that these environment variables can also be set by source’ing the
> generated etc/profile file.

something I noticed is that I see these recommendations also when the
environment variables are already set, precisely by sourcing the (previous)
$HOME/.guix-profile/etc/profile. Now the profile changed, so they need to
be re-sourced (which I usually do by calling "bash" from bash, since I source
from the .bashrc).

On the other hand, using the recommended environment variables would survive
profile changes, since they look like
   export PATH="/home/andreas/.guix-profile/bin:/home/andreas/.guix-profile/sbin${PATH:+:}$PATH"
instead of pointing to /gnu/store/...-profile/bin with a particular hash.

So the two are clearly not equivalent. Which of them is actually
preferable? I find it a bit confusing that after running
"guix package -i hello" I cannot run "hello" immediately, unlike in
Debian.

I would not be too worried about bash vs. other shells: The current
suggestions already would not work in csh...

Andreas

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-02-18 22:18 ` Andreas Enge
@ 2019-02-19  7:41   ` Ricardo Wurmus
  2019-02-19  8:10     ` Andreas Enge
  2019-02-19  9:17   ` Pjotr Prins
  1 sibling, 1 reply; 16+ messages in thread
From: Ricardo Wurmus @ 2019-02-19  7:41 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel


Hi Andreas,

> On Mon, Feb 18, 2019 at 10:56:13PM +0100, Ricardo Wurmus wrote:
>> when installing a package into a profile Guix very helpfully tells you
>> that you may need to set certain environment variables.  It doesn’t tell
>> you that these environment variables can also be set by source’ing the
>> generated etc/profile file.
>
> something I noticed is that I see these recommendations also when the
> environment variables are already set, precisely by sourcing the (previous)
> $HOME/.guix-profile/etc/profile. Now the profile changed, so they need to
> be re-sourced (which I usually do by calling "bash" from bash, since I source
> from the .bashrc).
>
> On the other hand, using the recommended environment variables would survive
> profile changes, since they look like
>    export PATH="/home/andreas/.guix-profile/bin:/home/andreas/.guix-profile/sbin${PATH:+:}$PATH"
> instead of pointing to /gnu/store/...-profile/bin with a particular hash.
>
> So the two are clearly not equivalent. Which of them is actually
> preferable? I find it a bit confusing that after running
> "guix package -i hello" I cannot run "hello" immediately, unlike in
> Debian.

This only needs to be done when GUIX_PROFILE is not set.  The
definitions in etc/profile either reference /gnu/store directories
directly (when GUIX_PROFILE is not set) or they reference the profile
links (when GUIX_PROFILE is set).

When GUIX_PROFILE is set an environment variable like PATH that is
already set to the profile’s “bin” directory will not have to be defined
again after installing another executable.

--
Ricardo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-02-19  7:41   ` Ricardo Wurmus
@ 2019-02-19  8:10     ` Andreas Enge
  2019-02-22  4:44       ` Chris Marusich
  0 siblings, 1 reply; 16+ messages in thread
From: Andreas Enge @ 2019-02-19  8:10 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hello,

On Tue, Feb 19, 2019 at 08:41:47AM +0100, Ricardo Wurmus wrote:
> This only needs to be done when GUIX_PROFILE is not set.  The
> definitions in etc/profile either reference /gnu/store directories
> directly (when GUIX_PROFILE is not set) or they reference the profile
> links (when GUIX_PROFILE is set).

that is an interesting point, thanks a lot for explaining it! So I think
that the best advice the command could give would be both to set GUIX_PROFILE
and to source etc/profile.

Andreas

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-02-18 22:18 ` Andreas Enge
  2019-02-19  7:41   ` Ricardo Wurmus
@ 2019-02-19  9:17   ` Pjotr Prins
  2019-02-19  9:34     ` Ricardo Wurmus
  1 sibling, 1 reply; 16+ messages in thread
From: Pjotr Prins @ 2019-02-19  9:17 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

On Mon, Feb 18, 2019 at 11:18:09PM +0100, Andreas Enge wrote:
> So the two are clearly not equivalent. Which of them is actually
> preferable? I find it a bit confusing that after running
> "guix package -i hello" I cannot run "hello" immediately, unlike in
> Debian.

Just running '. $PROFILE/etc/profile' is a bit dangerous. Especially on
HPC machines.

I guix-notes I also suggest to clear the other environment settings
first with

  env -i /bin/bash --login --noprofile --norc

But nobody loves me for that.

We have pure 'guix environment'. Maybe we should have a 'guix run' too
which starts a new shell with only those setting applicable to the
profile. I think you can do this with 'guix environment' but it is not
too clear. 

> I would not be too worried about bash vs. other shells: The current
> suggestions already would not work in csh...

it would be good to document though.

Pj.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-02-19  9:17   ` Pjotr Prins
@ 2019-02-19  9:34     ` Ricardo Wurmus
  2019-02-19 10:14       ` Pjotr Prins
  0 siblings, 1 reply; 16+ messages in thread
From: Ricardo Wurmus @ 2019-02-19  9:34 UTC (permalink / raw)
  To: Pjotr Prins; +Cc: guix-devel


Pjotr Prins <pjotr.public12@thebird.nl> writes:

> Just running '. $PROFILE/etc/profile' is a bit dangerous. Especially on
> HPC machines.
>
> I guix-notes I also suggest to clear the other environment settings
> first with
>
>   env -i /bin/bash --login --noprofile --norc

You can do this all in one go by passing etc/profile as the init file
for bash in this invocation of env.  No need to separately source
etc/profile then!

--
Ricardo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-02-19  9:34     ` Ricardo Wurmus
@ 2019-02-19 10:14       ` Pjotr Prins
  0 siblings, 0 replies; 16+ messages in thread
From: Pjotr Prins @ 2019-02-19 10:14 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Tue, Feb 19, 2019 at 10:34:05AM +0100, Ricardo Wurmus wrote:
> 
> Pjotr Prins <pjotr.public12@thebird.nl> writes:
> 
> > Just running '. $PROFILE/etc/profile' is a bit dangerous. Especially on
> > HPC machines.
> >
> > I guix-notes I also suggest to clear the other environment settings
> > first with
> >
> >   env -i /bin/bash --login --noprofile --norc
> 
> You can do this all in one go by passing etc/profile as the init file
> for bash in this invocation of env.  No need to separately source
> etc/profile then!

Maybe the output of guix package -i could be a number of pointers to
documentation instead? Or at least, after the current recommended
settings.

Pj.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-02-19  8:10     ` Andreas Enge
@ 2019-02-22  4:44       ` Chris Marusich
  0 siblings, 0 replies; 16+ messages in thread
From: Chris Marusich @ 2019-02-22  4:44 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]

Andreas Enge <andreas@enge.fr> writes:

> Hello,
>
> On Tue, Feb 19, 2019 at 08:41:47AM +0100, Ricardo Wurmus wrote:
>> This only needs to be done when GUIX_PROFILE is not set.  The
>> definitions in etc/profile either reference /gnu/store directories
>> directly (when GUIX_PROFILE is not set) or they reference the profile
>> links (when GUIX_PROFILE is set).
>
> that is an interesting point, thanks a lot for explaining it! So I think
> that the best advice the command could give would be both to set GUIX_PROFILE
> and to source etc/profile.

+1

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-02-18 21:56 Eliminate environment variable hints? Ricardo Wurmus
                   ` (2 preceding siblings ...)
  2019-02-18 22:18 ` Andreas Enge
@ 2019-03-04 21:56 ` Ludovic Courtès
  2019-03-06 13:25   ` Ricardo Wurmus
                     ` (2 more replies)
  3 siblings, 3 replies; 16+ messages in thread
From: Ludovic Courtès @ 2019-03-04 21:56 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hello,

Ricardo Wurmus <rekado@elephly.net> skribis:

> when installing a package into a profile Guix very helpfully tells you
> that you may need to set certain environment variables.  It doesn’t tell
> you that these environment variables can also be set by source’ing the
> generated etc/profile file.
>
> I have seen the bashrc and bash_profile files of many users and they are
> usually full of conflicting environment variable definitions.  In these
> files I often also see these Guix recommendations.
>
> I think Guix should suggest sourcing the generated etc/profile file
> instead of listing explicit environment variable definitions.  It would
> be less noisy and less confusing, in my opinion.
>
> What do you think?

When (re)sourcing etc/profile, you might clutter some variables.  For
instance, if you do that several times, you can end up with:

  PATH=$HOME/.guix-profile/bin:$HOME/.guix-profile/bin:$HOME/.guix-profile/bin:…

Conversely, the hint upon installation disappears if the entry is
already present in the variable.

That’s a fine point but I occasionally rely on this as a user.

That said, I understand your concern.  What about changing the message
to:

  You might need to run:

     . …/etc/profile

  Alternately, you can define the following environment variables:

     …

Too verbose?  Confusing?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-03-04 21:56 ` Ludovic Courtès
@ 2019-03-06 13:25   ` Ricardo Wurmus
  2019-03-06 13:48   ` Dan Frumin
  2019-03-18  4:52   ` Chris Marusich
  2 siblings, 0 replies; 16+ messages in thread
From: Ricardo Wurmus @ 2019-03-06 13:25 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


Ludovic Courtès <ludo@gnu.org> writes:

> When (re)sourcing etc/profile, you might clutter some variables.  For
> instance, if you do that several times, you can end up with:
>
>   PATH=$HOME/.guix-profile/bin:$HOME/.guix-profile/bin:$HOME/.guix-profile/bin:…
>
> Conversely, the hint upon installation disappears if the entry is
> already present in the variable.
>
> That’s a fine point but I occasionally rely on this as a user.

Ah, I see.

> That said, I understand your concern.  What about changing the message
> to:
>
>   You might need to run:
>
>      . …/etc/profile
>
>   Alternately, you can define the following environment variables:
>
>      …
>
> Too verbose?  Confusing?

I think it’s pretty verbose, but I think it would be good to have
“source …/etc/profile” appear at the *end* of the message.

(Guix generally produces a lot of output and in my experience people at
the MDC have learned to not read it… :-/)

If the last few lines give the most reliable hint (using “source”) I
think that would be most helpful.

--
Ricardo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-03-04 21:56 ` Ludovic Courtès
  2019-03-06 13:25   ` Ricardo Wurmus
@ 2019-03-06 13:48   ` Dan Frumin
  2019-03-18  4:52   ` Chris Marusich
  2 siblings, 0 replies; 16+ messages in thread
From: Dan Frumin @ 2019-03-06 13:48 UTC (permalink / raw)
  To: guix-devel

Hi,

I just wanted to add that I use an interactive shell with a different syntax (fish),
so I cannot just source a bsh script from my shell rc (AFAIK). To that extent having Guix print the exact variables I should be setting is actually 
quite useful.

Best,
Dan

On 04-03-19 22:56, Ludovic Courtès wrote:
> Hello,
> 
> Ricardo Wurmus <rekado@elephly.net> skribis:
> 
>> when installing a package into a profile Guix very helpfully tells you
>> that you may need to set certain environment variables.  It doesn’t tell
>> you that these environment variables can also be set by source’ing the
>> generated etc/profile file.
>>
>> I have seen the bashrc and bash_profile files of many users and they are
>> usually full of conflicting environment variable definitions.  In these
>> files I often also see these Guix recommendations.
>>
>> I think Guix should suggest sourcing the generated etc/profile file
>> instead of listing explicit environment variable definitions.  It would
>> be less noisy and less confusing, in my opinion.
>>
>> What do you think?
> 
> When (re)sourcing etc/profile, you might clutter some variables.  For
> instance, if you do that several times, you can end up with:
> 
>    PATH=$HOME/.guix-profile/bin:$HOME/.guix-profile/bin:$HOME/.guix-profile/bin:…
> 
> Conversely, the hint upon installation disappears if the entry is
> already present in the variable.
> 
> That’s a fine point but I occasionally rely on this as a user.
> 
> That said, I understand your concern.  What about changing the message
> to:
> 
>    You might need to run:
> 
>       . …/etc/profile
> 
>    Alternately, you can define the following environment variables:
> 
>       …
> 
> Too verbose?  Confusing?
> 
> Thanks,
> Ludo’.
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-03-04 21:56 ` Ludovic Courtès
  2019-03-06 13:25   ` Ricardo Wurmus
  2019-03-06 13:48   ` Dan Frumin
@ 2019-03-18  4:52   ` Chris Marusich
  2019-04-11  8:45     ` Ludovic Courtès
  2 siblings, 1 reply; 16+ messages in thread
From: Chris Marusich @ 2019-03-18  4:52 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> That said, I understand your concern.  What about changing the message
> to:
>
>   You might need to run:
>
>      . …/etc/profile
>
>   Alternately, you can define the following environment variables:
>
>      …
>
> Too verbose?  Confusing?

Personally I like what you've proposed.  On a related note, I dislike
that the suggestions do not include absolute paths.  I don't want to put
"my-profile/bin" in my PATH; I usually want to put
"$(pwd)/my-profile/bin" on my path.  If you follow the suggestions when
using relative paths, things break as soon as you cd somewhere else.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-03-18  4:52   ` Chris Marusich
@ 2019-04-11  8:45     ` Ludovic Courtès
  2019-04-12 15:10       ` Chris Marusich
  0 siblings, 1 reply; 16+ messages in thread
From: Ludovic Courtès @ 2019-04-11  8:45 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel

Hello,

Chris Marusich <cmmarusich@gmail.com> skribis:

> Personally I like what you've proposed.  On a related note, I dislike
> that the suggestions do not include absolute paths.  I don't want to put
> "my-profile/bin" in my PATH; I usually want to put
> "$(pwd)/my-profile/bin" on my path.  If you follow the suggestions when
> using relative paths, things break as soon as you cd somewhere else.

I fixed this in 21b3c0ca8789c22b9b689faa01286b18f103b92e.
Making progress!

Ludo’.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Eliminate environment variable hints?
  2019-04-11  8:45     ` Ludovic Courtès
@ 2019-04-12 15:10       ` Chris Marusich
  0 siblings, 0 replies; 16+ messages in thread
From: Chris Marusich @ 2019-04-12 15:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 184 bytes --]

Hi Ludo,

Ludovic Courtès <ludo@gnu.org> writes:

> I fixed this in 21b3c0ca8789c22b9b689faa01286b18f103b92e.
> Making progress!

What a simple fix!  Thank you.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-04-12 15:10 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-18 21:56 Eliminate environment variable hints? Ricardo Wurmus
2019-02-18 22:02 ` Brett Gilio
2019-02-18 22:08 ` Pierre Neidhardt
2019-02-18 22:18 ` Andreas Enge
2019-02-19  7:41   ` Ricardo Wurmus
2019-02-19  8:10     ` Andreas Enge
2019-02-22  4:44       ` Chris Marusich
2019-02-19  9:17   ` Pjotr Prins
2019-02-19  9:34     ` Ricardo Wurmus
2019-02-19 10:14       ` Pjotr Prins
2019-03-04 21:56 ` Ludovic Courtès
2019-03-06 13:25   ` Ricardo Wurmus
2019-03-06 13:48   ` Dan Frumin
2019-03-18  4:52   ` Chris Marusich
2019-04-11  8:45     ` Ludovic Courtès
2019-04-12 15:10       ` Chris Marusich

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.