User services- create instances

I have some understanding of systemd as it pertains to non-nixos systems. I’ve also read up (and created two of my own services in nixos). And I’ve spent some time browwing the nixpkgs code and nix modules code but I couldn’t figure out so I’m asking-

I want to create a user service which can have instances. (Ending in @ that is). The instances would be created based on reading a file in $XDG_CONFIG_HOME (one for each line). I want the instances to be autostarted when other user services start.

Is such a thing possible? On non-nixos, I’d have probably done systemd --user enable myservice@firstlineinconfigfile and systemd --user enable myservice@secondlineinconfigfile.

On second thoughts, perhaps there would be another oneshot service which would launch two instances of this service… Is that the only way though?

I haven’t tested this, but I believe that you could do something like this in your configuration.nix:"service@" = {
  # See
}"service@firstlineinconfigfile".wantedBy = [""];"service@secondlineinconfigfile".wantedBy = [""];

I will test this, thank you!