Background compiling with nix-shell

I have a derivation that doesn’t seem to be respecting

—cores or —max-jobs / -j

is there other way to limit the number of cores available to the build?

You can use

stdenv.mkDerivation {
  # ...
  enableParallelBuilding = false;
  # ...
}

on a per-derivation basis. Otherwise you can try setting the NIX_BUILD_CORES environment variable.

Neither of those worked, probably because these derivations are being built from a nix-shell, rather nix-build.

but thanks anyway for your efforts.

You should find out which derivation exactly this comes from. Maybe there is a build script that hardcodes something like make -j 4 or so which is obviously not caught by any of Nix’s mechanisms.

1 Like