System icons & themes not linked to /run/current-system/sw/share/

Why are the icons and themes installed at the system level, for example environment.systemPackages = with pkgs; [ rose-pine-gtk-theme ];, not sym-linked to /run/current-system/sw/share/?

System info:

> nixos-version
24.11.20240804.cb9a96f (Vicuna)
  • Using both my nixpkgs and home-manager as flake inputs
  • Following unstable packages: nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

Using home manager I’m able to set my gtk theme, which loads the theme correctly for gtk applications. However, when configuring applications manually, for example dunst, I need to reference the nix store package outputs for the theme (/nix/store/j32xb56sp3npka7iql9n53md9svji7yw-rose-pine-icon-theme-unstable-2022-09-01/share/icons/rose-pine/16x16/apps/firefox.svg) which feels a little wrong.

I would imagine themes would be sym-linked like below so that you have a common location for theme and icons files and don’t have to use long hash file paths in your config files (which will change and break your configs if/when the package updates).

# This is what I would expect, but it does not happen
/run/current-system/sw/share/icons/rose-pine -> /nix/store/j32xb56sp3npka7iql9n53md9svji7yw-rose-pine-icon-theme-unstable-2022-09-01/share/icons/rose-pine

I see there is an environment.pathsToLink attribute in a module which looks like it may have the effect I’m looking for, but I see that none of the theme packages in nixpkgs set this option, and I’m guessing that’s for a reason.

I’m able to configure applications like dunst correctly by directly referencing files in /nix/store/, but I’m wondering if there is a better (more robust and organized) way to do this.

Just wondering if I’m missing something or just generally have the wrong idea about how this is intended to work. Thank you!

Packages cannot set NixOS options. Your desktop environment is supposed to set up linking paths it needs – or if you are building your own desktop environment from scratch, you are responsible for setting up the paths.

Though icons should be linked out of the box:

Thank you for your help!

I’m building my own desktop environment and setting xdg.icons.enable = true; as well as installing icon packages using environment.systemPackages (and not home.packages) resolved the issue and I’m seeing the icons and themes in /run/current-system/sw/share/ as I would expect.