Apps installed via Home Manager are not visible within GNOME

Apps installed via the Home Manager are not visible within GNOME (i.e. when pressing SUPER + A). This is not an issue when installing an app via configuration.nix file – i.e. in such case the app is automatically detected by GNOME.

The only way for GNOME is detect new app installed via the Home Manager is to log out + log in, which is tedious.

I’ve read this github issue and tried some fixes and yet they do not work on NixOS as they seem to target other OSs.

These are my configurations:

  1. configuration.nix
  2. home.nix

I also confirm that XDG_DATA_DIRS env var is set and is pointing to $HOME/.nix-profile/share/applications

update-desktop-database command does not seem to work as well:

$ update-desktop-database 
The databases in [/nix/store/vh1lyr8g3b707g8dhpjka86fkggkw3h4-gnome-console-46.0/share/applications, /nix/store/a4vrkmwzhvys0jyjgagzxzf5bh9ijlxi-gsettings-desktop-schemas-46.0/share/gsettings-schemas/gsettings-desktop-schemas-46.0/applications, /nix/store/qq5snwnnx3zv7x18pd120wwz0iq2dnvc-gtk4-4.14.4/share/gsettings-schemas/gtk4-4.14.4/applications, /nix/store/vh1lyr8g3b707g8dhpjka86fkggkw3h4-gnome-console-46.0/share/gsettings-schemas/gnome-console-46.0/applications, /nix/var/nix/profiles/default/share/applications, /home/nixuser/.nix-profile/share/applications, /usr/share/ubuntu/applications, /usr/local/share/applications, /usr/share/applications, /var/lib/snapd/desktop/applications, /home/nixuser/.nix-profile/share/applications/applications, /nix/store/52xa4lhprjsjfir8dy2ky6q01rfgs43g-gnome-mimeapps/share/applications, /nix/store/ng78vpgqx6d6m814q0czn09003pmflyv-desktops/share/applications, /home/nixuser/.nix-profile/share/applications, /nix/profile/share/applications, /home/nixuser/.local/state/nix/profile/share/applications, /etc/profiles/per-user/nixuser/share/applications, /nix/var/nix/profiles/default/share/applications, /run/current-system/sw/share/applications, /nix/store/k5hg8yblg6p3xd85j8d8db78rxbhzlz8-gnome-shell-46.2/share/gsettings-schemas/gnome-shell-46.2/applications, /nix/store/sgiwy0rjcjj2gx4hz7qrqdgmjs0h9qxf-gnome-shell-extensions-46.2/share/gsettings-schemas/gnome-shell-extensions-46.2/applications, /nix/store/bhdppy8hhfb3gnnqslcd58scmmalsxjd-gnome-session-46.0/share/applications, /nix/store/a4vrkmwzhvys0jyjgagzxzf5bh9ijlxi-gsettings-desktop-schemas-46.0/share/gsettings-schemas/gsettings-desktop-schemas-46.0/applications, /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/share/gsettings-schemas/gtk+3-3.24.42/applications, /nix/store/2b7lb9cggkay97h4k3yamzqglfh0qdjn-gnome-settings-daemon-46.0/share/gsettings-schemas/gnome-settings-daemon-46.0/applications, /nix/store/bhdppy8hhfb3gnnqslcd58scmmalsxjd-gnome-session-46.0/share/gsettings-schemas/gnome-session-46.0/applications, /nix/store/k5hg8yblg6p3xd85j8d8db78rxbhzlz8-gnome-shell-46.2/share/applications] could not be updated.

Same error occurs when running it as root.

Using NixOS 24.05.2028.e4509b3a560c (Uakari)

Kinda late to the party here, but in case someone else finds this, I myself have been able to solve this by adding this to my home.nix

  home.activation.copyDesktopFiles = lib.hm.dag.entryAfter ["installPackages"] ''
    if [ "$XDG_CURRENT_DESKTOP" = "GNOME" ]; then

      if [ ! -d "${config.home.homeDirectory}/.local/share/applications" ]; then
        mkdir "${config.home.homeDirectory}/.local/share/applications"
      fi

      if [ -d "${config.home.homeDirectory}/.local/share/applications/nix" ]; then
        rm -rf "${config.home.homeDirectory}/.local/share/applications/nix"
      fi

      ln -sf "${config.home.homeDirectory}/.nix-profile/share/applications" \
        ${config.home.homeDirectory}/.local/share/applications/nix

    fi
  '';

this will:

  • check if .local/share/applications exists, and create if it doesn’t (just a sanity check)
  • check if .local/share/applications/nix exists, and deletes if it does
  • creates a symlink from .nix-profile/share/aplications to .local/share/applications/nix

So far it has been working wonderfully in my machine, and it won’t touch existing .desktop files like the ones Chromium creates for web apps, which I use a lot.

I hope this helps