Nix desktop files

Supposing that you are using a distribution other than NixOS, then yes you can expect your desktop environment to be looking for your applications in /usr/share/applications while those installed with Nix are actually in ~/.nix-profile/share/applications.

Instead of creating a symlink from /usr/share/applications you should rather tell you desktop where to look. You should be able to do so by adding the following to your ~/.profile:

export XDG_DATA_DIRS=$HOME/.nix-profile/share:$HOME/.share:"${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}"

So your desktop will be looking for applications both in /usr/share/applications and ~/.nix-profile/share/applications, with a priority given to the applications installed with Nix.

For more info, https://nixos.org/wiki/KDE#Using_KDE_outside_NixOS

Tags:

Nix

.Desktop