Xdg-portal pathsToLink assertion failing on home-manager

While upgrading my config to switch nixpkgs release from 25.05 to 25.11, an assertion added recently to home-manager’s xdg.portal module is failing even though it shouldn’t:

Failed assertions:
       - spiwocoal profile: xdg.portal: since you installed Home Manager via its NixOS module and
       'home-manager.useUserPackages' is enabled, you need to add

       environment.pathsToLink = [ `/share/applications` `/share/xdg-desktop-portal` ];

       to your NixOS configuration so that the portal definitions and DE

I can confirm that I have that configuration set on my NixOS config, but it seems that HM is not recognizing it correctly

 environment =
    {
      # [...]
      pathsToLink = ["/share/applications" "/share/xdg-desktop-portal"];
    };

I have HM installed via the NixOS module this way:

  imports =
    lib.flatten [
      (with inputs; [
        home-manager.nixosModules.default
        # [...]
      ])
      # [...]
    ];

And then the HM module is setup as follows:

{
  lib,
  config,
  inputs,
  outputs,
  ...
}: let
  user = config.hostSpec.username;
  hostname = config.hostSpec.hostName;
in {
  home-manager = {
    extraSpecialArgs = {
      inherit inputs outputs;
    };
    sharedModules = [
      {
        hostSpec = config.hostSpec;
      }
    ];
    useGlobalPkgs = true;
    useUserPackages = true;
    users = {
      ${user} = import (lib.custom.relativeToRoot "home-manager/${user}/${hostname}.nix");
    };
  };
}

Any clue why that assertion might be failing?

nvm, I figured what the problem was, because I use impermanence on some hosts, I had the following on my config:

  environment =
    {
      # [...]
      pathsToLink = ["/share/applications" "/share/xdg-desktop-portal"];
    }
    // lib.mkIf hasImpermanence {
      persistence."/persist/system" = {
        directories = [
          "/var/cache/tuigreet"
        ];
      };
    };

which, for some reason was not merging correctly the set, so I changed it to

  environment = lib.mkMerge [
    {
      # [...]
      pathsToLink = ["/share/applications" "/share/xdg-desktop-portal"];
    }
    (lib.mkIf hasImpermanence {
      persistence."/persist/system" = {
        directories = [
          "/var/cache/tuigreet"
        ];
      };
    })
  ];

And the assertion stopped failing