I’m using (single-user-install) nix and home-manager on Fedora 43 with KDE. It works great for the most part, except that installed applications do not get correctly picked up by the KDE application launcher. I notice a few issues:
I have to run “update-desktop-database” after installing apps. Otherwise they do not appear in the launcher. The NIX paths appear correctly in $XDG_DATA_DIRS.
I have to manually give execute access (chmod u+x) to the corresponding .desktop files, otherwise the launcher complains it doesn’t have the right permissions.
The above seems to fix some applications, although I noticed Zoom coredumps when executed through the launcher (invalid Elf handle?) but works when executed from the command line. I don’t know how to start debugging this issue.
My question then, what is the correct way to integrate nix-managed applications with the KDE environment? I’ve found two options that seem relevant (xdg.enable and xdg.mime.enable), but they don’t seem to help.
As a rule of thumb, you shouldn’t use graphical applications from nixpkgs on a regular Linux, here the way how nixpkgs deals with some dependencies is incompatible with how regular Linuxes deal with them.
For simple apps it might work, though for more complex ones or OpenGL apps it will break.
Tools like NixGL exist for this reason, though this introduces a different set of problems.
The KDE launcher doesn’t automatically pick up Nix-installed applications because the desktop entries aren’t correctly integrated into your environment.
To fix this, add the following to your home.nix:
xdg = {
enable = true;
mime.enable = true;
};
If you still have to manually chmod the .desktop files, also add this home.activation script:
I have this nix-script to deal with the issue in Kubuntu 24.04 (KDE 5.27):
# Make programs installed via this config file have their desktop entries
# appear in KDE's application launcher
# Source: https://github.com/nix-community/home-manager/issues/1439#issuecomment-1106208294,
# but use a folder where desktop files do not have to be in a subfolder, as KDE's launcher
# does not seem to find files from there
{ config, lib, ... }:
{
home.activation.linkDesktopApplications = {
after = [
"writeBoundary"
"createXdgUserDirectories"
];
before = [ ];
data = ''
rm -rf ${config.xdg.dataHome}/nix-desktop-files/applications
mkdir -p ${config.xdg.dataHome}/nix-desktop-files/applications
cp -Lr ${config.home.homeDirectory}/.nix-profile/share/applications/* ${config.xdg.dataHome}/nix-desktop-files/applications/
'';
};
xdg.enable = true;
xdg.systemDirs.data = [ "${config.xdg.dataHome}/nix-desktop-files" ];
}
However, see the link in comment. There might be better way to fix this nowadays.
Home Manager has new way for dealing with GPU support, which doesn’t involve NixGL. If you have targets.genericLinux.gpu.enable enabled Home Manager prints a command that sets up the GPU support for you:
$ home-manager switch
...
GPU drivers require an update, run
sudo /nix/store/5sjdg6splbilwhvfxkkjppggvxqnp38n-non-nixos-gpu/bin/non-nixos-gpu-setup
Thank you, I have to take a look, that might simplify my current neovide setup.
Still I try to avoid doing graphical stuff, due to the historical problems it made and might continue to make.
Anyway, the ZOOM thing is barely fixable without logs, and I do not know how to access them if the problem only exists when started through the launcher, but not when started from a terminal.