A guide to better DE-Integration for the GNU Guix Package Manager.
This has been tried and tested (successfully) in the following desktop environments:
- GNOME (Debian 10.2 'Buster')
- MATE, XFCE, KDE (Linux Mint 19 'Tara')
- Cinnammon (Linux Mint 19.1 'Tessa')
- Pantheon (Elementary OS 5.0 'Juno')
For all the amazing benifits of GNU Guix, one thing it still lacks is proper integration with the desktop environment of the host system (foreign distros). A GUI program installed using GUIX is not available from the GUI menus of the host system (unlike Flatpak). However, with the following steps, one can integrate Guix-installed-applications with the desktop environment in a pretty decent manner:
- Create a new file -
guix.sh
- in/etc/profile.d
, containing the following lines (will require root privileges):
export GUIX_PROFILE="$HOME/.guix-profile"
export GUIX_LOCPATH="$GUIX_PROFILE/lib/locale"
export PATH="$HOME/.config/guix/current/bin${PATH:+:}$PATH"
eval `guix package --search-paths=prefix 2> /dev/null`
# set XDG_DATA_DIRS to include Guix installations
export XDG_DATA_DIRS="$GUIX_PROFILE/share${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"
(or simply copy the guix.sh
file below - with further conditional checks - into your /etc/profile.d
)
- Log out and log back in to see the GUI applications (
openshot
,aegisub
, etc.) in your GUI menus.
/etc/profile
, is an init file that is executed by all login-shells on a GNU/Linux system. In most modern distros,/etc/profile
also reads files ending in.sh
residing inside/etc/profile.d
. Hence, the file/etc/profile.d/guix.sh
; the commands contained therein are executed while logging in to a user-session.- The first two lines are just plain-old guix-recommended, basic stuffs. They set the
GUIX_PROFILE
, andGUIX_LOCPATH
environment variables for the user currently logging in. guix package --search-path
returns all the environment variables that should be set in order for the programs installed using guix to run properly. Among the other things, it also exports the PATH variable. However, it does not include$HOME/.config/guix/current/bin
(which contains the latest version of guix obtained via aguix pull
). Hence the 3rd line. This causes the latest guix to run in the subsequent calls toguix
in the session.- The last line returns a list of all environment variables required to be set for the guix-installed programs to function properly, first. The list is then
eval
-ed and thus the environment is established: all set and ready for guix-installed packages to function properly. - The line that exports the
XDG_DATA_DIR
is the most important one, that does the DE-integration.
- While uninstalling an application (
guix remove openshot
) did remove the application from the menus; subsequent installation and--roll-back
s had no effect on the menu whatsoever.
- Perhaps triggers could be set in motion after every guix transaction (if the user has opt-ed in for it during installation or via some other configuration) that would take care of the menu, etc. updates?
I'm using Triskel 10 with KDE, and it doesn't seem to work still. In the profile.d folder there is also a "zzz-guix.sh" file with the following code:
Do you think this is doing anything to disrupt guix.sh, or maybe I'm doing something else wrong? I've gotten it working on Triskel before, but I can't for the life of me remember what I did.