Tuning NixOS build

On one of my hosts the build has started hanging. If there is a better way I’m open to ideas but my researching led me to believe that setting max-jobs and cores can tunes the build process.

My question, if there is not a better way to do it, would be how do I set these parameters? Is it environment variables or a command. The page on the subject casually states there are configuration option but not how to set them (standard nixos docs)

Searching “configuration” in the nix manual leads to this page: nix.conf - Nix Reference Manual which shows various places where you can set the configuration options.

You can also search for NixOS options on this on https://search.nixos.org/options, for example https://search.nixos.org/options?channel=24.05&show=nix.settings.max-jobs

1 Like

I’ll see if I can work out where it is I’ve never played around with any of those files before

nix.conf is by default located at /etc/nix/nix.conf.

The settings can also be changed on an ad-hoc basis by using --option cores <cores> and --option max-jobs <max-jobs> on the nix command line.

nix.conf is by default located at /etc/nix/nix.conf.

Just a reminder: in NixOS this file is auto-generated from the system configuration.