Run enable multiple instaces of the same systemd service

Hello I would like to enable multiple instances of the same systemd service. Like you do with:

systemctl enable queue_worker\@{1..3}.service

or as described here:

Is it possible to declare as part of the a NixOS configuration?

Thanks a lot

systemd.services."queue_worker@" = { ... };

See e.g. nixpkgs/kresd.nix at 1bf1f7a75fc139db5c500550efd51568a32cf9be · NixOS/nixpkgs · GitHub

Ah sorry, I misread, but the nixpkgs link I gave you also addresses your specific problem (by defining a target with explicit dependency on all the @ units it wants enabled).

Is it possible to declare as part of the a NixOS configuration?

Sure.

{
  systemd.services."foo@" = {
    description = "foo, instance %i";
    serviceConfig = {
      Type = "oneshot";
      ExecStart = "/my/batch/file %i";
    };
  };
}