Can I set the nice level for Nix build processes?

Sorry for resurrecting this old thread, but I think this information will be valuable for others coming here just like me.

I’m using NixOS on desktop and, while it was doing some automated system upgrade today, my desktop got a bit frozen. So, I got here. The solution was for NixOS 20.09, quite old now.

Quoting from NixOS 21.11 release notes:

So, for more modern NixOS desktop usage, this module should make it snappier:

{
  nix.daemonCPUSchedPolicy = "idle";
  nix.daemonIOSchedClass = "idle";
}

Please read the options’ docs for details. I haven’t tested it intensively yet, FWIW.

1 Like