Subject: Re: bug#56661: EMACSLOADPATH not set when using Guix System + Guix Home + SLIM + Mate

From: Maxime Devos <[email-masked]>
Date: Wed, 20 Jul 2022 14:30:30 +0200

On 20-07-2022 14:08, Andrew Tropin wrote:
> Hi Maxime,
>
> According to the documentation to get all the environment variables set
> correctly you either need to manage your login shell with Guix Home or
> do additional configuration of your shell:
> https://guix.gnu.org/manual/devel/en/html_node/Configuring-the-Shell.html

I am not using a login shell, though I suppose there might be one under 
the hood somewhere (IIRC, and if it hasn't changed, some login managers 
are wrapped in Guix System to insert a bash --login in-between). Even if 
I am using a (non-login) shell, there's still an issue: if I start an 
application via the graphical things, they don't get all the environment 
variables (I tested this by opening a terminal that starts bash and 
doing "echo $EMACSLOADPATH", but that a shell is used for the test seems 
irrelevant here to me).

>  From what I see you manage bash with Guix Home,
I am not. I just keep the default ~/.bash_profile etc that a fresh Guix 
System install gave me and the only reason bash_profile things appear in 
the home configuration is because "guix home import" generated that. I'm 
not managing anything, just keeping the defaults.
> so according to the
> source code your bash_profile should look differently from what you've
> posted and must contain `source ~/.profile` in it:

~/.bash_profile does contain that line:

# Set up the system, user profile, and related variables.
# /etc/profile will be sourced by bash automatically
# Set up the home environment profile.
if [ -f ~/.profile ]; then source ~/.profile; fi

# Honor per-interactive-shell startup file
if [ -f ~/.bashrc ]; then source ~/.bashrc; fi
# Honor per-interactive-shell startup file
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

However, .bash_profile (the one from the local-file) does not:

# Honor per-interactive-shell startup file
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

> https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/home/services/shells.scm#n440
>
> This line makes your login shell

I am not using a login shell but a graphical environment -- the only 
reason I actually use a shell at all is because I find it more 
convenient to open a terminal and type "emacs" than to look in the 
graphical desktop thingy for the Emacs icon. Also, I'm not finding Emacs 
here even though in the previous installation of Guix System (GDM + Mate 
IIRC, without Guix Home but with "guix install ...".  Icedove isn't 
appearing there either, though the browser is.

I recall that it login shells were not necessary on Guix System + 
~/.guix-profile (without Guix Home), at least for the desktop 
environment combination I used back then, though it was required on my 
Debian system to do "bash --login".  I can do "bash --login" on my Guix 
System + Guix Home setup to start a login shell, but that would be a 
regression.

>   source .profile, which sources
> setup-environment, which sources ~/.guix-home/profile/etc/profile, which
> sets EMACSLOADPATH.
>
> Additionally, I've built the home environment you provided and it
> contains the code I mentioned above.
>
> Make sure that ~/.bash_profile and ~/.guix-home/files/.bash_profile
> point to the same file in the store.

antipode@antipode ~$ ls -l .bash_profile
lrwxrwxrwx 1 antipode users 56 19 jul 22:14 .bash_profile -> 
/gnu/store/1cq87qf8zccxlnkjwifcyhawmxvy7wfw-bash_profile

antipode@antipode ~$ ls -l ~/.guix-home/files/.bash_profile
lrwxrwxrwx 1 root root 56  1 jan  1970 
/home/antipode/.guix-home/files/.bash_profile -> 
/gnu/store/1cq87qf8zccxlnkjwifcyhawmxvy7wfw-bash_profile

They do.  Also, shouldn't ~/.bash_profile point to 
~/.guix-home/files/.bash_profile instead of directly to the store, to be 
more atomic (unrelated to #56661 though), like done for symlinks in /etc 
in Guix System?

Greetings,
Maxime.