Sorry for not coming back for a while on this . Both the generic user detection and the new script works great.
I still had some issues with having the python websocket module be recognized properly so I did add it outside of the configuration (in extra of what is already in the configuration (maybe I just ) so it is available user-wide. Even someone commented on my gist about that. Actually I retested and even when removing that module outside the config, it works. So I might have done something wrong in the past.
Anyway, I think that it would be possible to automate it but I think I’d like the maintainer take on it too. I will create an issue on their github if they are interested of automating it if I provide some help on the config (maybe getting to nixpkgs) or if it is better to keep it independent (either pushing it to nixpkgs still or simply providing it as a flake).
Also I added a check if the symlink already exist to prevent script failure:
wallpaper-engine-kde-plugin.text = ''
wallpaperenginetarget=/share/plasma/wallpapers/com.github.catsout.wallpaperEngineKde
mkdir -p /home/${builtins.head (builtins.attrNames config.users.users)}/.local/share/plasma/wallpapers
chown -R ${builtins.head (builtins.attrNames config.users.users)}:users /home/${builtins.head (builtins.attrNames config.users.users)}/.local/share/plasma
if [ ! -e /home/${builtins.head (builtins.attrNames config.users.users)}/.local$wallpaperenginetarget ]; then
ln -sf ${wallpaper-engine-kde-plugin}/$wallpaperenginetarget /home/${builtins.head (builtins.attrNames config.users.users)}/.local/$wallpaperenginetarget
fi;
'';