Re-using systemd user services from other distros

On Archlinux, I’m wrapping a python script in a systemd user service. It seems I cannot use that service file on NixOS, as the python3 executable is not found when trying to start the service (although python3 is declared in environment.systemPackages).

Instead of just copying the user service definition over from Archlinux, I can create the user service by specifying it in and add the required binaries to the path definition, which works fine.

Still I’m wondering if there is a way to simply re-use systemd user services from Non-NixOS machines.

You could then do a drop in by using systemd.user.sevices to override the Exec, or add to the service’s Environment.

Either what @worldofpeace said, or you need to define python3 as something like

ExecStart = "${pkgs.python3}/bin/python3 ..."

Try this: /usr/bin/env python3