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

From: Giovanni Biscuolo <[email-masked]>
Date: Thu, 28 Apr 2022 17:59:35 +0200

Hi Maxim and bo0od,

This is my report about my recent testing experience with guix installed
desktop applications in a desktop environment on Debian 11 (I usually do
not use a desktop environment with a graphical menu, I use i3).

I've added "in Desktop Menus" to the subject because actually users can
find and run applications using a terminal (dash shell in Debian) or the
"Execute" menu option found in many Desktop Environments (this means
$PATH configuration is fine).

The user experience is this:

0. user install the guix package manager via apt

1. user logs in via display manager (I tested LXDM and GDM3, installed
via apt)

2. user gets a desktop manager (I tested LXDE and Mate, installad via
apt) with a graphical menu

3. user installs a desktop application via "guix package..."

4. user does /not/ see the newly installed application, but the person
can start the program via terminal or "Execute" menu item (with
completion, this means $PATH does include the ~/.guix-profile/<stuff>)

Maxim Cournoyer <[email-masked]> writes:

[...]

> There are two things that Guix does to help users correctly configure
> their system so that Guix installed applications appear on PATH.

Yes: PATH configuration works, it's not the problem causing this bug
report.

> 1. The guix-install.sh installation script installs a
> /etc/profile.d/guix.sh script that configures the PATH when logging in:
>
> --8<---------------cut here---------------start------------->8---

[...]

> # set XDG_DATA_DIRS to include Guix installations
> export XDG_DATA_DIRS="$GUIX_PROFILE/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}"
> --8<---------------cut here---------------end--------------->8---
>
> It even set XDG_DATA_DIRS, which should allow integration with the GNOME
> Shell and other graphical dashboards.

No: this does not work, for three reasons:

1. AFAIU "/etc/profile.d/guix.sh" or "~/.profile" are not
sourced/executed in a graphical session (graphical shell?), we need to
~/.xsessionrc to configure that environment: am I wrong?

2. XDG_DATA_DIRS gets someway hard reset by "something" to this value:

XDG_DATA_DIRS=/usr/local/share:/usr/share:/usr/share/gdm:/var/lib/menu-xdg:/usr/local/share/:/usr/share/:/usr/share/gdm/:/var/lib/menu-xdg/

(I found workaround, see below)

3. desktop menus (I tested LXDE and Mate, not Gnone Shell) are not
updated

This is my workaround, in ~/.profile I have:

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

### Guix settings
#
# add Guix current path
export PATH="$HOME/.config/guix/current/bin${PATH:+:}$PATH"
# Locale path
export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
# add Guix infopath
export INFOPATH="$HOME/.config/guix/current/share/info:$INFOPATH"
# set default Guix profile
export GUIX_PROFILE="$HOME/.guix-profile"
# source default Guix profile
. $GUIX_PROFILE/etc/profile

# Needed to find Guix XDG data, included *.desktop files
# when not set, XDG_DATA_HOME is $HOME/.local/share
# only ONE directory is permitted, setting two does not work (?)
export XDG_DATA_HOME="$GUIX_PROFILE/share"

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

and in ~/.xsessionrc:

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

if [ -f ~/.profile ]; then
    . ~/.profile
fi
 
--8<---------------cut here---------------end--------------->8---

The main point of this workaround is that I configure XDG_DATA_HOME,
described in the specifications:

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

$XDG_DATA_HOME defines the base directory relative to which
user-specific data files should be stored. If $XDG_DATA_HOME is either
not set or empty, a default equal to $HOME/.local/share should be used.

--8<---------------cut here---------------end--------------->8---
(from
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)

With the above workaround I'm able to see all guix installed *.desktop
files in the menu of my desktop environment (tested on LXDE mainly).

Anyway to make the new installed *.desktop files appear in the menu, I
have to logout and login again: I've still not found a command (or
configuration) to update the menu, "xdg-desktop-menu forceupdate" does
not work.

[...]

If my experience is consistent with those of other users, I'm willing to
propose a patch for the manual (I'm thinking of a specific "2.6.6 -
XSession setup" in (guix)Getting Started)

WDYT?

Thanks! Gio'

-- 
Giovanni Biscuolo

Xelera IT Infrastructures