Home Manager 25.11: kwallet pam for sway

sudo nix-channel --list               
home-manager https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz
nixos https://nixos.org/channels/nixos-25.11

Under Home Manager NixOS 25.05 the following config for sway made kwallet Pam work:

".config/sway/config" = {
  enable = true;
  source = pkgs.replaceVars {
    src =
      /etc/nixos/config/sway.conf; # contains @kwalletPam@/libexec/pam_kwallet_init
    kwalletPam = pkgs.kdePackages.kwallet-pam;
  };
};

whereas sway.conf contains the following line:

exec @kwalletPam@/libexec/pam_kwallet_init 1> ${HOME}/log/sway/pam_kwallet_init.out 2> ${HOME}/log/sway/pam_kwallet_init.err

However in 25.11 I get the following error:

error: A definition for option `home-manager.users.klt.home.file.".config/sway/config".source' is not of type `absolute path'. Definition values:
- In `/nix/store/c3464i7ag3v36rdndbqh461hvdgqgqng-home-manager-25.11.tar.gz/home-manager/nixos/common.nix': <function>

What do I need to change?
Where can I define the variable substitution?

What is the return type of pkgs.replaceVars?

I found the input types but not the output on:

https://noogle.dev/f/pkgs/replaceVars

Try wrapping it in a string interpolation.

I have found a solution:

".config/sway/config" = {
  enable = true;
  text = builtins.readFile /etc/nixos/config/sway.conf + ''
    # use dynamically generated path to pam_kwallet_init
    exec ${pkgs.kdePackages.kwallet-pam}/libexec/pam_kwallet_init; 1> $HOME/log/sway/pam_kwallet_init.out 2> $HOME/log/sway/pam_kwallet_init.err
  '';
};

see full code on Codeberg:
https://codeberg.org/klt/configurations/src/commit/d5ef180b252c93acb3099f98c87ed910f90ac837/nixos/home_sharedModules.nix#L108