How to define nice level for a service

I would like to set nice value for a process (e.g. collectd) and I do not know how nor where to find the answer myself.

I already have ‘services.collectd.enable = true;’ in configuration.nix and both Bard and ChatGPT suggest I should add ‘services.collectd.nice = 10;’. However, I get ‘error: The option `services.collectd.nice’ does not exist.'.
Bart also claims that ‘The ability to set the nice value of a service was introduced in NixOS 22.05.’

I was looking for an answer at NixOS 23.05 manual | Nix & NixOS

I’m running nixos-version: 23.05.3580.5d017a8822e0 (Stoat)

That would be systemd.services.<name>.serviceConfig.Nice.

https://www.freedesktop.org/software/systemd/man/systemd.exec.html#Nice=

Bart also claims that ‘The ability to set the nice value of a service was introduced in NixOS 22.05.’

Don’t believe LLMs. They don’t know what they’re talking about.

1 Like

Great, thanks! My mistake was that I assumed that this is service config but is really a systemd config.