Subject: bug#48796: Guix on Debian 11 - Cant run or find applications from Guix

From: Giovanni Biscuolo <[email-masked]>
Date: Thu, 17 Jun 2021 16:56:42 +0200

Hi,

I use Guix on top of Debian, but I installed it long ago "manually" and
not via the Debian package "guix"... anyway once installed there are no
differences :-)

Mark H Weaver <[email-masked]> writes:

[...]

>> both of the commands worked but the x package has no icon nor i can run 
>> it using terminal.
>
> The reason you can't simply type "icecat" in the terminal is because
> Guix puts the 'icecat' executable in ~/.guix-profile/bin/icecat, but
> that directory is not in your PATH environment variable.

bo0od please ensure you have this in your ~/.bash_profile:

--8<---------------cut here---------------start------------->8---

GUIX_PROFILE="$HOME/.config/guix/current"
. "$GUIX_PROFILE/etc/profile"

--8<---------------cut here---------------end--------------->8---

Actually, I set all the env variables for Guix in my ~/.profile that
(AFAIU) on Debian is included by default in ~/.bash_profile:

My ~/.bash_profile:

--8<---------------cut here---------------start------------->8---

if [ -f ~/.profile ]; then
    . ~/.profile
fi

--8<---------------cut here---------------end--------------->8---

My (edited) ~/.profile:

--8<---------------cut here---------------start------------->8---

### Guix settings
#
# add Guix current path
export PATH="$HOME/.config/guix/current/bin${PATH:+:}$PATH"
# add Guix infopath
export INFOPATH="$HOME/.config/guix/current/share/info:$INFOPATH"
# Guix locpath
export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
# set default Guix profile
export GUIX_PROFILE="$HOME/.guix-profile"
# set Guix extra profiles
export GUIX_EXTRA_PROFILES="$HOME/.guix-extra-profiles"
# set timezone data dir (zoneinfo)
export TZDIR=${GUIX_PROFILE}/share/zoneinfo
# source default Guix profile
. $GUIX_PROFILE/etc/profile

### XDG_CONFIG_DIRS fixes
# see Message-ID: <[email-masked]>
unset XDG_CONFIG_DIRS
export XDG_CONFIG_DIRS="${GUIX_PROFILE}/etc/xdg:/etc/xdg"

--8<---------------cut here---------------end--------------->8---

Actually I don't know if all env variables are still really needed, I
need to test things

Also (I don't know why) in my home this two profiles are differing:

--8<---------------cut here---------------start------------->8---

$HOME/.config/guix/current -> /var/guix/profiles/per-user/root/current-guix
$HOME/.guix-profile -> /var/guix/profiles/per-user/giovanni/guix-profile

--8<---------------cut here---------------end--------------->8---

so I'm using my user (giovanni) profile for my GUIX_PROFILE env
variable.

[...]

> That's because environment variable settings are _not_ global.  Each
> process has its own set of environment variable settings.  Typically,
> newly spawned processes inherit their environment variable settings
> from the parent process that launched them.

This is the reason why with Guix installed programs we have to set the
variables for each shell we use:

1. for the bash shell you do this by setting the variables in
~/.bash_profile (or ~/.profile like I'm doing)

> In order to set your environment variables appropriately for your entire
> desktop environment, you must arrange for the environment variable
> settings to be loaded before the desktop session is launched.  I don't
> remember off-hand how to do this in Debian.  I seem to recall that one
> approach is to create an ~/.xsessionrc file,

Yes, AFAIK Mark is right:

2. for the desktop environment (shell) I include ~/.profile in my
~/.xsessionrc (because I like to keep all variables in one place)

My ~/.xsessionrc:

--8<---------------cut here---------------start------------->8---

if [ -f ~/.profile ]; then
    . ~/.profile
fi

--8<---------------cut here---------------end--------------->8---

This way all your xsessions (all X sessions should read ~/.xsessionrc)
will have the right environment (from your default Guix profile) and you
will be able to start Guix installed programs there (i.e. I use i3 for
this and it works well)

For the record, application and icons are sourced by XDG compliant
desktop environment from the XDG_DATA_DIRS env variable, that variable
should be in your default user profile, in
$HOME/.guix-profile/etc/profile, that you should source both in
~/.bash_profile and ~/.xsessionrc as explained above

> which should be an executable Bash script

AFAIU it can be a regular file

[...]

> I'm surprised this isn't well-trodden territory, long ago documented in
> our manual, but I guess it isn't.  It would be good if some Debian
> expert(s), or at least someone who runs Guix on top of Debian, would
> step forward to fill in the details.

I'll try do propose some patch for the Guix manual but... don't hold
your breath, I need some testing.

Happy hacking! Gio'

[...]

-- 
Giovanni Biscuolo

Xelera IT Infrastructures