Re: Eliminate environment variable hints?

2019-04-12 Thread Chris Marusich
Hi Ludo,

Ludovic Courtès  writes:

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

What a simple fix!  Thank you.

-- 
Chris


signature.asc
Description: PGP signature


Re: Eliminate environment variable hints?

2019-03-17 Thread Chris Marusich
Ludovic Courtès  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


signature.asc
Description: PGP signature


Re: Eliminate environment variable hints?

2019-03-06 Thread Dan Frumin

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  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’.





Re: Eliminate environment variable hints?

2019-03-06 Thread Ricardo Wurmus


Ludovic Courtès  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




Re: Eliminate environment variable hints?

2019-03-04 Thread Ludovic Courtès
Hello,

Ricardo Wurmus  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’.



Re: Eliminate environment variable hints?

2019-02-21 Thread Chris Marusich
Andreas Enge  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


signature.asc
Description: PGP signature


Re: Eliminate environment variable hints?

2019-02-19 Thread Pjotr Prins
On Tue, Feb 19, 2019 at 10:34:05AM +0100, Ricardo Wurmus wrote:
> 
> Pjotr Prins  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.



Re: Eliminate environment variable hints?

2019-02-19 Thread Ricardo Wurmus


Pjotr Prins  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




Re: Eliminate environment variable hints?

2019-02-19 Thread Pjotr Prins
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.



Re: Eliminate environment variable hints?

2019-02-19 Thread Andreas Enge
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




Re: Eliminate environment variable hints?

2019-02-18 Thread Ricardo Wurmus


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




Re: Eliminate environment variable hints?

2019-02-18 Thread Andreas Enge
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




Re: Eliminate environment variable hints?

2019-02-18 Thread Pierre Neidhardt
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/


signature.asc
Description: PGP signature


Re: Eliminate environment variable hints?

2019-02-18 Thread Brett Gilio


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