How do I run package as a service

Hi, I’m using home-manager on macOS and wanting to run libvirt as a daemon, in brew there is brew services start libvirt, is there any alternative in nix? I searched but couldn’t find answer

1 Like

It seems nix-darwin has no pre-defined daemon for libvirt.

You could create a new launchd daemon with launchd.daemons.
Is that enough info to get you started?

1 Like

Thank u! I’m running regular home-manager, not nix-darwin. I will take a look later, for now I just run the service using homebrew.

Ah I see! I think home-manager alone can’t do this, as it can only manage user configuration, not system configuration, and services are a system feature. corrected below.

and services are a system feature.

Hm has no issues running user services. Libvirt can also run in “session” mode where no root access is required.


Nice, can u give me an example, please? I don’t know anything about it.

Is “it” in this context running user services in HM or libvirt in session mode?

In case of the former, check the home-manager documentation/source and in case of the latter, the libvirtd docs.


thanks, I’ll take a look