Home-manager recursive links

I’m trying to write a module that links all installled fonts, themes and icons to ~/.local/share/ for the well working of flatpak applications (which can’t access directly ~/.nix-profile/share)

First, I tried to declare all themes, fonts and icons in three lists:

...
with pkgs; let
  icons = [
    (runCommand "bibata-icon-ice" {} ''
      mkdir -p $out/share/icons
      tar -xf ${fetchurl {
        url = "https://github.com/ful1e5/Bibata_Cursor/releases/download/v2.0.3/Bibata-Modern-Ice.tar.gz";
        sha256 = "4a429343301a3fcb11e7ff738c903703b3dd113efd8e221742cfbfd7714e0e98";
      }} -C $out/share/icons

    '')
  ];

  themes = [
    dracula-theme
  ];

  fonts = [
    noto-fonts
    noto-fonts-cjk
    noto-fonts-emoji
    font-awesome
    (nerdfonts.override {fonts = ["FiraCode" "DroidSansMono" "Monofur"];})
  ];
...

And through the function:

...
link = type: builtins.listToAttrs (builtins.map (theme: {
    name = "${theme.name}";
    value = {
      target = ".local/share";
      source = "${theme}/share/";
      recursive = true;
    };
  }) type);
in {
  home.file = (link icons) // (link themes) // (link fonts);
...

To create a set of all installed fonts, themes and icons to ~/.local/share (each single one theme has its own name, but the same target “.local/share”).

Expected behavior: the home-manager recursively links and merge every theme (since the themes do not have the same files at the same dirs) just like it does in ~/.nix-profile/share/

What I got:

error:
       Failed assertions:
       - Conflicting managed target files: .local/share

       This may happen, for example, if you have a configuration similar to

           home.file = {
             conflict1 = { source = ./foo.nix; target = "baz"; };
             conflict2 = { source = ./bar.nix; target = "baz"; };
           }

since a theme (dracula-theme per example) can have many dirs/files at …/share I need to link the entire ${dracula-theme}/share to ~/.local/share

how does home-manager smartly link all installed packages in ~/.nix-profile? How can I do that to merge a set of dirs into a single one (with no need to link directly ~/.nix-profile/share to ~/.local/share)?

I’m currently running Nix on Arch Linux, home-manager and nixpkgs unstable.

I wonder home-manager do the stuff in ~/.nix-profile through pkgs.symlinkJoin, I have never tested it…