In NixOS when an icon theme is a parent of other icon themes from different packages and they are installed system wide, there are a proliferation of symbolic links in /run/current-system/sw/share/icons
.
For refrence see:
https://github.com/NixOS/nixpkgs/pull/85229
Suppose a situation where an icon theme themeA
is a parent theme of other icon themes theme1
and theme2
. Because of that themeA
would appear in the nix store several times: once in its own package, and also as a symbolic link in the packages of the child themes:
/nix/store/themeA_dir/share/icons/themeA
/nix/store/theme1_dir/share/icons/themeA -> /nix/store/themeA_dir/share/icons/themeA
/nix/store/theme2_dir/share/icons/themeA -> /nix/store/themeA_dir/share/icons/themeA
In this situation themeA
would also appear several times in /run/current-system/sw/share/icons
, generating conflicts:
/run/current-system/sw/share/icons/themeA -> /nix/store/themeA_dir/share/icons/themeA
/run/current-system/sw/share/icons/themeA -> /nix/store/theme1_dir/share/icons/themeA
/run/current-system/sw/share/icons/themeA -> /nix/store/theme2_dir/share/icons/themeA
But notice that all of them points to the same directory in the nix store after following the symbolic links.
When those collisions are detected by a nixos module, a new directory /run/current-system/sw/share/icons/themeA
is created and the contents of /nix/store/themeA_dir/share/icons/themeA
, /nix/store/theme1_dir/share/icons/themeA
and /nix/store/theme2_dir/share/icons/themeA
are recursively merged there. At the end each file in the theme is linked individually.
It would be much more efficient to detect that each of /nix/store/theme{A,1,2}_dir/share/icons/themeA
resolves to the same directory in the nix store after following symbolic links, and just use it as the target link in /run/current-system/sw/share/icons
.
I would like to know from others if this new approach is viable and can be implemented in NixOS.