I have started using the systemd “user lingering” feature on one of my NixOS systems, and I would like to add a NixOS option for controlling this functionality. From the loginctl(1) man page:
enable-linger [USER...], disable-linger [USER...]
Enable/disable user lingering for one or more users. If enabled for a specific user, a user manager is spawned for the user at boot and kept around after logouts. This allows users who are not logged in to run long-running services. Takes one or more user names or numeric UIDs as argument. If no argument is specified, enables/disables lingering for the user of the session of the caller.
Enabling this this simply creates an empty file at /var/lib/systemd/linger/USER.
I think the option belongs either in users.users.<name> as a boolean attribute, or in systemd.users as a list of usernames. As far as I can tell, there are no systemd-related options under users.users.<name>, so systemd.users seems the more appropriate place. I would like to get some feedback before opening a pull request to implement the option.
If you don’t have enough feedback, consider pinging the people listed as maintainers of the package you intend to contribute to. The maintainers are in the package files somewhere.
Linger is important for running Docker services in rootless mode. Otherwise you need a logged-in user session for the containers to stay up, which is not ideal for network services that are supposed to be persistent.
I haven’t had a need for docker/podman-compose, so I can’t really say anything about that, but you can configure containers through virtualisation.oci-containers which is what I do for zigbee2mqtt. Very straight-forward.