unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* guix environment and .bashrc
@ 2019-01-03 18:53 zimoun
  2019-01-03 20:14 ` Gábor Boskovits
  0 siblings, 1 reply; 3+ messages in thread
From: zimoun @ 2019-01-03 18:53 UTC (permalink / raw)
  To: help-guix

Dear Guixers,

I am running Guix on the top of Debian and I have issue with `guix
environment --pure'.
Well, the documentation provides some tips but I am not sure to understand.
https://www.gnu.org/software/guix/manual/en/html_node/Invoking-guix-environment.html

I use the Awesome window manager and then I open different xterm.
Then the shell is an interactive shell but not a login shell---if I
understand well---so the dance with .profile, .bash_profile and
.bashrc is not working. I mean when I open an xterm window, the file
.bash_profile is not read, therefore the env variables are not setup.

The way that I use is to add an `else' clause to the $GUIX_ENVIRONMENT test:

if [ -n "$GUIX_ENVIRONMENT" ]
then
    export PS1="\u@\h \w [dev]\$ "
else
   source ~/.bash_profile
fi

Is it correct and the right way to do?
If yes, does the manual need improvement in this section (footnote)?


Thank you for any tips.

All the best,
simon

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

* Re: guix environment and .bashrc
  2019-01-03 18:53 guix environment and .bashrc zimoun
@ 2019-01-03 20:14 ` Gábor Boskovits
  2019-01-03 22:53   ` zimoun
  0 siblings, 1 reply; 3+ messages in thread
From: Gábor Boskovits @ 2019-01-03 20:14 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

Hello,

zimoun <zimon.toutoune@gmail.com> ezt írta (időpont: 2019. jan. 3., Cs, 19:53):
>
> Dear Guixers,
>
> I am running Guix on the top of Debian and I have issue with `guix
> environment --pure'.
> Well, the documentation provides some tips but I am not sure to understand.
> https://www.gnu.org/software/guix/manual/en/html_node/Invoking-guix-environment.html
>

I also had this problem on Debian.

> I use the Awesome window manager and then I open different xterm.
> Then the shell is an interactive shell but not a login shell---if I
> understand well---so the dance with .profile, .bash_profile and
> .bashrc is not working. I mean when I open an xterm window, the file
> .bash_profile is not read, therefore the env variables are not setup.
>

What I did was to set up things in .xsessionrc. There is a drawback, though, and
it is that this startup file uses /bin/sh, which is most probably
dash, so I had to
adjust the recommendation of sourcing the profile. I also got some indications
that the generated file I sourced might assume that the used shell is bash.

> The way that I use is to add an `else' clause to the $GUIX_ENVIRONMENT test:
>
> if [ -n "$GUIX_ENVIRONMENT" ]
> then
>     export PS1="\u@\h \w [dev]\$ "
> else
>    source ~/.bash_profile
> fi
>
> Is it correct and the right way to do?
> If yes, does the manual need improvement in this section (footnote)?
>

I believe it should be improved. There might also be some other distro specific
chevats. There was also a discussion about reducing bashism in the generated
files, but I don't remember if a conclusion was reached.

>
> Thank you for any tips.
>
> All the best,
> simon
>

Best regards,
g_bor

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

* guix environment and .bashrc
  2019-01-03 20:14 ` Gábor Boskovits
@ 2019-01-03 22:53   ` zimoun
  0 siblings, 0 replies; 3+ messages in thread
From: zimoun @ 2019-01-03 22:53 UTC (permalink / raw)
  To: Gábor Boskovits; +Cc: help-guix

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

Dear Gábor,

Thank you for your comments.

> What I did was to set up things in .xsessionrc. There is a drawback,
though, and
> it is that this startup file uses /bin/sh, which is most probably
> dash, so I had to
> adjust the recommendation of sourcing the profile. I also got some
indications
> that the generated file I sourced might assume that the used shell is
bash.

Yes, Debian uses dash as /bin/sh since a couple of release, I guess.


> > The way that I use is to add an `else' clause to the $GUIX_ENVIRONMENT
test:
> >
> > if [ -n "$GUIX_ENVIRONMENT" ]
> > then
> >     export PS1="\u@\h \w [dev]\$ "
> > else
> >    source ~/.bash_profile
> > fi
> >
> > Is it correct and the right way to do?
> > If yes, does the manual need improvement in this section (footnote)?
> >
>
> I believe it should be improved. There might also be some other distro
specific
> chevats. There was also a discussion about reducing bashism in the
generated
> files, but I don't remember if a conclusion was reached.

From my point of view the topic is about the interactive shell that it is
used and the fix should not depend so much on the host distro. I imagine.
:-)

Maybe I do not understand a point, but the trick explained in the footnote
of the manual is not accurate. Or I am wrong and I am asking more
explanations. :-)

Well, in X session, when an user opens a terminal, the shell is more often
a non-login interactive shell than a login interactive shell if it is.
Therefore, the file .bash_profile or .profile are not sourced when a
terminal is open on X session.
From my point of view, the simplest fix is at the shell configuration
level, I guess.
For bash, source a file containing all the exports when not in
$GUIX_ENVIRONMENT or something in the spirit is enough, isn't it?
For zsh or other, it depends on how the configuration is sourced; I do not
know.

What do you think?
Or where is wrong?


Thank you in advance for any comments.


All the best,
simon

[-- Attachment #2: Type: text/html, Size: 2344 bytes --]

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

end of thread, other threads:[~2019-01-03 22:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-03 18:53 guix environment and .bashrc zimoun
2019-01-03 20:14 ` Gábor Boskovits
2019-01-03 22:53   ` zimoun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).