all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* "The following environment variable definitions may be needed"
@ 2017-05-10  5:53 Chris Marusich
  2017-05-10  9:19 ` ng0
  2017-05-10 12:01 ` Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: Chris Marusich @ 2017-05-10  5:53 UTC (permalink / raw)
  To: help-guix

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

Hi,

Sometimes, when you install a package, you get a message like this:

--8<---------------cut here---------------start------------->8---
[0] marusich@garuda:/tmp
$ guix package -p test-profile -i guile
The following package will be installed:
   guile	2.2.2	/gnu/store/5zx29y44nrqj0s8h3jlvlj82k8hj4dxs-guile-2.2.2

1 package in profile
The following environment variable definitions may be needed:
   export PATH="test-profile/bin${PATH:+:}$PATH"
[0] marusich@garuda:/tmp
$ 
--8<---------------cut here---------------end--------------->8---

Up until now, I've always added the recommended export statements to my
~/.bashrc or ~/.bash_profile.  I (mistakenly?) assumed that's what the
message was really telling me to do.  However, I've just learned that
these recommended variables also appear to get exported in
$GUIX_PROFILE/etc/profile, which is automatically sourced by
/etc/profile on GuixSD.  Even on a foreign distro,
$GUIX_PROFILE/etc/profile is automatically sourced if one follows the
guidance in the manual ((guix) Binary Installation):

--8<---------------cut here---------------start------------->8---
     Source ‘etc/profile’ to augment ‘PATH’ and other relevant
     environment variables:

          # GUIX_PROFILE=$HOME/.guix-profile \
            source $GUIX_PROFILE/etc/profile
--8<---------------cut here---------------end--------------->8---

This leads to my question: If I'm using GuixSD (or a foreign distro in
which $GUIX_PROFILE/etc/profile is automatically sourced), do I need to
add these recommended export statements to my ~/.bashrc or
~/.bash_profile?

My suspicion is that the answer is "no".  The next time I reboot or log
out and back in, the environment variables will be set correctly even if
I don't add them to my ~/.bashrc or ~/.bash_profile.  In fact, by adding
them there, I would be adding redundant entries.  I am hoping that
someone can confirm that my understanding is correct.

-- 
Chris

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

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

* Re: "The following environment variable definitions may be needed"
  2017-05-10  5:53 "The following environment variable definitions may be needed" Chris Marusich
@ 2017-05-10  9:19 ` ng0
  2017-05-10 12:01 ` Ludovic Courtès
  1 sibling, 0 replies; 7+ messages in thread
From: ng0 @ 2017-05-10  9:19 UTC (permalink / raw)
  To: Chris Marusich; +Cc: help-guix

Chris Marusich transcribed 2.9K bytes:
> Hi,
> 
> Sometimes, when you install a package, you get a message like this:
> 
> --8<---------------cut here---------------start------------->8---
> [0] marusich@garuda:/tmp
> $ guix package -p test-profile -i guile
> The following package will be installed:
>    guile	2.2.2	/gnu/store/5zx29y44nrqj0s8h3jlvlj82k8hj4dxs-guile-2.2.2
> 
> 1 package in profile
> The following environment variable definitions may be needed:
>    export PATH="test-profile/bin${PATH:+:}$PATH"
> [0] marusich@garuda:/tmp
> $ 
> --8<---------------cut here---------------end--------------->8---
> 
> Up until now, I've always added the recommended export statements to my
> ~/.bashrc or ~/.bash_profile.  I (mistakenly?) assumed that's what the
> message was really telling me to do.  However, I've just learned that
> these recommended variables also appear to get exported in
> $GUIX_PROFILE/etc/profile, which is automatically sourced by
> /etc/profile on GuixSD.  Even on a foreign distro,
> $GUIX_PROFILE/etc/profile is automatically sourced if one follows the
> guidance in the manual ((guix) Binary Installation):
> 
> --8<---------------cut here---------------start------------->8---
>      Source ‘etc/profile’ to augment ‘PATH’ and other relevant
>      environment variables:
> 
>           # GUIX_PROFILE=$HOME/.guix-profile \
>             source $GUIX_PROFILE/etc/profile
> --8<---------------cut here---------------end--------------->8---
> 
> This leads to my question: If I'm using GuixSD (or a foreign distro in
> which $GUIX_PROFILE/etc/profile is automatically sourced), do I need to
> add these recommended export statements to my ~/.bashrc or
> ~/.bash_profile?
> 
> My suspicion is that the answer is "no".  The next time I reboot or log
> out and back in, the environment variables will be set correctly even if
> I don't add them to my ~/.bashrc or ~/.bash_profile.  In fact, by adding
> them there, I would be adding redundant entries.  I am hoping that
> someone can confirm that my understanding is correct.
> 
> -- 
> Chris

on GuixSD with my bash using user, I do this in
$HOME/.bash_profile:

source $HOME/.guix-profile/etc/profile

You do not have to have the entry twice in your
shell related files. You could just issue the
command in bash after you installed something,
type "source ~/.guix-profile/etc/profile" and
your variables will be updated.

(I write explicitly bash because we could do better
and enable users of all shells to get the right
variables from the start.

I'm currently thinking about an solution here.)
-- 
https://pragmatique.xyz
PGP: https://people.pragmatique.xyz/ng0/

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

* Re: "The following environment variable definitions may be needed"
  2017-05-10  5:53 "The following environment variable definitions may be needed" Chris Marusich
  2017-05-10  9:19 ` ng0
@ 2017-05-10 12:01 ` Ludovic Courtès
  2017-05-10 13:39   ` myglc2
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2017-05-10 12:01 UTC (permalink / raw)
  To: Chris Marusich; +Cc: help-guix

Hi!

Chris Marusich <cmmarusich@gmail.com> skribis:

> This leads to my question: If I'm using GuixSD (or a foreign distro in
> which $GUIX_PROFILE/etc/profile is automatically sourced), do I need to
> add these recommended export statements to my ~/.bashrc or
> ~/.bash_profile?

No.

> My suspicion is that the answer is "no".  The next time I reboot or log
> out and back in, the environment variables will be set correctly even if
> I don't add them to my ~/.bashrc or ~/.bash_profile.  In fact, by adding
> them there, I would be adding redundant entries.  I am hoping that
> someone can confirm that my understanding is correct.

Confirmed!

I think the recommendations that ‘guix package’ produces are still
useful though, precisely because $GUIX_PROFILE/etc/profile won’t be
re-sourced until you log in again.

Exercise for the reader: extend Bash with Guile-Bash such that the new
environment variable settings are automatically effected when ‘guix
package’ is run.  :-)

Ludo’.

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

* Re: "The following environment variable definitions may be needed"
  2017-05-10 12:01 ` Ludovic Courtès
@ 2017-05-10 13:39   ` myglc2
  2017-05-10 21:49     ` Niall Dooley
  0 siblings, 1 reply; 7+ messages in thread
From: myglc2 @ 2017-05-10 13:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix

On 05/10/2017 at 14:01 Ludovic Courtès writes:

> Hi!
>
> Chris Marusich <cmmarusich@gmail.com> skribis:
>
>> This leads to my question: If I'm using GuixSD (or a foreign distro in
>> which $GUIX_PROFILE/etc/profile is automatically sourced), do I need to
>> add these recommended export statements to my ~/.bashrc or
>> ~/.bash_profile?
>
> No.
>
>> My suspicion is that the answer is "no".  The next time I reboot or log
>> out and back in, the environment variables will be set correctly even if
>> I don't add them to my ~/.bashrc or ~/.bash_profile.  In fact, by adding
>> them there, I would be adding redundant entries.  I am hoping that
>> someone can confirm that my understanding is correct.
>
> Confirmed!
>
> I think the recommendations that ‘guix package’ produces are still
> useful though, precisely because $GUIX_PROFILE/etc/profile won’t be
> re-sourced until you log in again.

These messages were a source of confusion for me.  It is really great to
see this clarified.

What if we change the message from ...

The following environment variable definitions may be needed:
   export PATH="test-profile/bin${PATH:+:}$PATH"

... to ...

If you need the package before the next login, do:
   export PATH="test-profile/bin${PATH:+:}$PATH"

> Exercise for the reader: extend Bash with Guile-Bash such that the new
> environment variable settings are automatically effected when ‘guix
> package’ is run.  :-)

This sounds cool. Could you please expand on it a bit?

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

* Re: "The following environment variable definitions may be needed"
  2017-05-10 13:39   ` myglc2
@ 2017-05-10 21:49     ` Niall Dooley
  2017-05-11  8:55       ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Niall Dooley @ 2017-05-10 21:49 UTC (permalink / raw)
  To: myglc2; +Cc: help-guix

This too has confused me so perhaps an update of the manual is in order. Like
others I too followed the instructions in the manual
(https://www.gnu.org/software/guix/manual/guix.html#Invoking-guix-package)
and have the following
in my .bashrc (my system (a foreign distro - Trisquel 7) doesn't have a
.bash_profile but only a .profile which sources .bashrc):


GUIX_PROFILE=$HOME/.guix-profile \
source $HOME/.guix-profile/etc/profile


(Note I removed the quotes as given in the manually as I believe they are only
necessary if there is whitespace.)

The problem is this duplicates an entry in my PATH, as follows:

$HOME/.guix-profile/bin
$HOME/bin
$HOME/.guix-profile/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games

Removing the definition of GUIX_PROFILE from my .bashrc and only keeping the
`source' line does not resolve this duplication. It merely replaces
$HOME/.guix-profile in the path with the /gnu/store pathname if that makes
sense.

Now, the contents of $HOME/.guix_profile/etc/profile is as follows:


# Source this file to define all the relevant environment variables in Bash
# for this profile.  You may want to define the 'GUIX_PROFILE' environment
# variable to point to the "visible" name of the profile, like this:
#
#  GUIX_PROFILE=/path/to/profile \
#  source /path/to/profile/etc/profile
#
# When GUIX_PROFILE is undefined, the various environment variables refer
# to this specific profile generation.

export PATH="${GUIX_PROFILE:-/gnu/store/dvnb3dz37zlzm2yxivlm90kbfdzqyb25-profile}/bin${PATH:+:}$PATH"
export GIT_SSL_CAINFO="${GUIX_PROFILE:-/gnu/store/dvnb3dz37zlzm2yxivlm90kbfdzqyb25-profile}/etc/ssl/certs/ca-certificates.crt${GIT_SSL_CAINFO:+:}$GIT_SSL_CAINFO"
export INFOPATH="${GUIX_PROFILE:-/gnu/store/dvnb3dz37zlzm2yxivlm90kbfdzqyb25-profile}/share/info${INFOPATH:+:}$INFOPATH"


I suspect this duplication comes from the definition here of the PATH. Is
that correct?

To me at least the instructions in the manual and the advise from both ng0
and Ludo in this thread conflict? Or am I misunderstanding something obvious.

Thanks in advance.

On 10 May 2017 at 14:39, myglc2 <myglc2@gmail.com> wrote:
> On 05/10/2017 at 14:01 Ludovic Courtès writes:
>
>> Hi!
>>
>> Chris Marusich <cmmarusich@gmail.com> skribis:
>>
>>> This leads to my question: If I'm using GuixSD (or a foreign distro in
>>> which $GUIX_PROFILE/etc/profile is automatically sourced), do I need to
>>> add these recommended export statements to my ~/.bashrc or
>>> ~/.bash_profile?
>>
>> No.
>>
>>> My suspicion is that the answer is "no".  The next time I reboot or log
>>> out and back in, the environment variables will be set correctly even if
>>> I don't add them to my ~/.bashrc or ~/.bash_profile.  In fact, by adding
>>> them there, I would be adding redundant entries.  I am hoping that
>>> someone can confirm that my understanding is correct.
>>
>> Confirmed!
>>
>> I think the recommendations that ‘guix package’ produces are still
>> useful though, precisely because $GUIX_PROFILE/etc/profile won’t be
>> re-sourced until you log in again.
>
> These messages were a source of confusion for me.  It is really great to
> see this clarified.
>
> What if we change the message from ...
>
> The following environment variable definitions may be needed:
>    export PATH="test-profile/bin${PATH:+:}$PATH"
>
> ... to ...
>
> If you need the package before the next login, do:
>    export PATH="test-profile/bin${PATH:+:}$PATH"
>
>> Exercise for the reader: extend Bash with Guile-Bash such that the new
>> environment variable settings are automatically effected when ‘guix
>> package’ is run.  :-)
>
> This sounds cool. Could you please expand on it a bit?
>

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

* Re: "The following environment variable definitions may be needed"
  2017-05-10 21:49     ` Niall Dooley
@ 2017-05-11  8:55       ` Ludovic Courtès
  2017-05-11 19:55         ` Niall Dooley
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2017-05-11  8:55 UTC (permalink / raw)
  To: Niall Dooley; +Cc: myglc2, help-guix

Niall Dooley <dooleyn@gmail.com> skribis:

> This too has confused me so perhaps an update of the manual is in order. Like
> others I too followed the instructions in the manual
> (https://www.gnu.org/software/guix/manual/guix.html#Invoking-guix-package)
> and have the following
> in my .bashrc (my system (a foreign distro - Trisquel 7) doesn't have a
> .bash_profile but only a .profile which sources .bashrc):

You should source ~/.guix-profile/etc/profile from .profile or
.bash_profile, not .bashrc, so that it is sourced only once when you log
in.

If you source it from .bashrc, it ends up being sourced every time you
spawn a new shell, leading to duplicate entries in PATH,
GUILE_LOAD_PATH, etc.

HTH!

Ludo’.

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

* Re: "The following environment variable definitions may be needed"
  2017-05-11  8:55       ` Ludovic Courtès
@ 2017-05-11 19:55         ` Niall Dooley
  0 siblings, 0 replies; 7+ messages in thread
From: Niall Dooley @ 2017-05-11 19:55 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: myglc2, help-guix

It certainly does. I hadn't fully appreciated the subtle differences between
these dotfiles and when they are sourced. Thanks a lot Ludo.
Niall


On 11 May 2017 at 09:55, Ludovic Courtès <ludo@gnu.org> wrote:
> Niall Dooley <dooleyn@gmail.com> skribis:
>
>> This too has confused me so perhaps an update of the manual is in order. Like
>> others I too followed the instructions in the manual
>> (https://www.gnu.org/software/guix/manual/guix.html#Invoking-guix-package)
>> and have the following
>> in my .bashrc (my system (a foreign distro - Trisquel 7) doesn't have a
>> .bash_profile but only a .profile which sources .bashrc):
>
> You should source ~/.guix-profile/etc/profile from .profile or
> .bash_profile, not .bashrc, so that it is sourced only once when you log
> in.
>
> If you source it from .bashrc, it ends up being sourced every time you
> spawn a new shell, leading to duplicate entries in PATH,
> GUILE_LOAD_PATH, etc.
>
> HTH!
>
> Ludo’.

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

end of thread, other threads:[~2017-05-11 19:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-10  5:53 "The following environment variable definitions may be needed" Chris Marusich
2017-05-10  9:19 ` ng0
2017-05-10 12:01 ` Ludovic Courtès
2017-05-10 13:39   ` myglc2
2017-05-10 21:49     ` Niall Dooley
2017-05-11  8:55       ` Ludovic Courtès
2017-05-11 19:55         ` Niall Dooley

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.