Subject: Re: bug#27386: offloading documentation and env

From: ng0 <[email-masked]>
Date: Wed, 28 Jun 2017 22:36:36 +0000

Ludovic Courtès transcribed 2.2K bytes:
> ng0 <[email-masked]> skribis:
> 
> > I think the method as described never really worked.
> >
> > When I do as you (and the manual) suggested, I no longer
> > have any results for ssh host env | grep "GUILE_".
> >
> > When I extend it like this it works. I include the full
> > paste to show that previously I had the sourcing of /etc/profile
> > in it:
> >
> > user@shadownet ~$ cat .bashrc
> > # Bash initialization for interactive non-login shells and
> > # for remote shells (info "(bash) Bash Startup Files").
> >
> > # Export 'SHELL' to child processes.  Programs such as 'screen'
> > # honor it and otherwise use /bin/sh.
> > export SHELL
> >
> > if [ -n "$SSH_CLIENT" -a -z "`type -P cat`" ]
> > then
> >     # We are being invoked from a non-interactive SSH session
> >     # (as in "ssh host command") but 'cat' cannot be found
> >     # in $PATH.  Source /etc/profile so we get $PATH and other
> >     # essential variables.
> >     source /etc/profile
> > fi
> >
> > # Adjust the prompt depending on whether we're in 'guix environment'.
> > if [ -n "$GUIX_ENVIRONMENT" ]
> > then
> >     PS1='\u@\h \w [env]\$ '
> > else
> >     PS1='\u@\h \w\$ '
> > fi
> > source ~/.guix-profile/etc/profile
> > alias ls='ls -p --color'
> > alias ll='ls -l'
> > GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH}:/run/current-system/profile/lib/guile/2.2/site-ccache:/run/current-system/profile/share/guile/site/2.2"
> > GUILE_LOAD_PATH="${GUILE_LOAD_PATH}:/run/current-system/profile/share/guile/site/2.2"
> 
> The difference compared to /etc/skel/.bashrc is the last two lines,
> right?

Yes. And that I source ~/.guix-profile/etc/profile before those lines.

> On my GuixSD installation they’re not needed because /etc/profile
> sources /run/current-system/profile/etc/profile, which already defines
> these two variables.

Well this file is the same on both systems involved:

user@abyayala ~$ cat /etc/profile
# Crucial variables that could be missing in the profiles' 'etc/profile'
# because they would require combining both profiles.
# FIXME: See <http://bugs.gnu.org/20255>.
export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/man
export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share
export XDG_CONFIG_DIRS=$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg

# Ignore the default value of 'PATH'.
unset PATH

# Load the system profile's settings.
GUIX_PROFILE=/run/current-system/profile \
. /run/current-system/profile/etc/profile

# Prepend setuid programs.
export PATH=/run/setuid-programs:$PATH

# Since 'lshd' does not use pam_env, /etc/environment must be explicitly
# loaded when someone logs in via SSH.  See <http://bugs.gnu.org/22175>.
# We need 'PATH' to be defined here, for 'cat' and 'cut'.  Do this before
# reading the user's 'etc/profile' to allow variables to be overridden.
if [ -f /etc/environment -a -n "$SSH_CLIENT" \
     -a -z "$LINUX_MODULE_DIRECTORY" ]
then
  . /etc/environment
  export `cat /etc/environment | cut -d= -f1`
fi

if [ -f "$HOME/.guix-profile/etc/profile" ]
then
  # Load the user profile's settings.
  GUIX_PROFILE="$HOME/.guix-profile" \
  . "$HOME/.guix-profile/etc/profile"
else
  # At least define this one so that basic things just work
  # when the user installs their first package.
  export PATH="$HOME/.guix-profile/bin:$PATH"
fi

# Set the umask, notably for users logging in via 'lsh'.
# See <http://bugs.gnu.org/22650>.
umask 022

# Allow GStreamer-based applications to find plugins.
export GST_PLUGIN_PATH="$HOME/.guix-profile/lib/gstreamer-1.0"

if [ -n "$BASH_VERSION" -a -f /etc/bashrc ]
then
  # Load Bash-specific initialization code.
  . /etc/bashrc
fi

> But maybe your global profile is slightly different from mine, which
> would explain this.  FWIW I have:
> 
> --8<---------------cut here---------------start------------->8---
> $ guix package -I gui -p /run/current-system/profile
> guix	0.13.0-2.de9d8f0	out	/gnu/store/js4ml3w20ysh4znp9wl0da0ljji4kisl-guix-0.13.0-2.de9d8f0
> guile	2.2.2	out	/gnu/store/5zx29y44nrqj0s8h3jlvlj82k8hj4dxs-guile-2.2.2
> --8<---------------cut here---------------end--------------->8---

user@shadownet ~$ guix package -I gui -p /run/current-system/profile
guix	0.13.0-2.de9d8f0	out	/gnu/store/nrd0v38d61l8y16vqkb1gws0bw45q885-guix-0.13.0-2.de9d8f0
guile	2.2.2	out	/gnu/store/1pzfigry5bnh3n146w0ib77vkd2g6jdc-guile-2.2.2

So it is not different.
The system in use is this: https://gitlab.com/ng0/systems/blob/master/servers/pragmatique/shadownet.scm

> Anyway, if you have ideas on how to improve the doc, they’re welcome.
> 
> Thanks for your feedback!
> 
> Ludo’.
-- 
ng0
GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
GnuPG: https://n0is.noblogs.org/my-keys
infotropique: https://www.infotropique.org