Installing systemd services for packages?


I’m new to NixOS and wondering about the recommended way to enable some daemons.

There are multiple packages that have a daemon component which the nixpkgs currently do not start. Specifically, I’m talking about lldpd, netserver, iperf2, where it would be kinda nice if there was some kind of configuration option to install a /etc/systemd/system/[daemon].service.

Maybe there’s already a pattern for doing this please?

Thanks in advance,

Hi @randomizedcoder, most of the packages that have a daemon component are installed via a dedicated configuration entry to add to your configuration.nix, see for example the entry for lldpd.

Thank you @azazel75 !!

I had been trying all sorts of craziness ( don’t do this! )

  users.users._lldpd = {
    group = "_lldpd";
    isNormalUser = false; # one of these must be set
    isSystemUser = true;
    description = "LLDPd";
    createHome = false;
  users.groups._lldpd = {};

When all I needed was a simple

services.lldpd.enable = true;

For the other daemon, I guess I can look to essentially clone the way lldpd does it.

Thanks again!