[Nix-dev] Re: Parallel building support, 1st attempt

Marc Weber marco-oweber at gmx.de
Tue Jun 22 20:51:52 CEST 2010


Hi Jeff,

> >>> 1) Nix-env provides the environment variable $NIX_BUILD_CORES. The
> >>>   default value is 1, which is equivalent to building with
> >>>   parallelism disabled.
> >> Specify the means to set the envvar please, like what the inputs to
> >> the heuristic are. There are most definitely "portability" issues
> >> associated with discovering #CORES and the details should be spelled
> >> out.

How I understood the patch:

  NIX_BUILD_CORES is passed to the build job. Its not used to tell any nix
  command about the numbers of cores which should be used.

  This is done by this line getting the value from nix.conf config file:
  ++    buildCores = std::max(queryIntSetting("build-cores", 1u), 1u);

  these lines taking the arguments from command line:
  ++        else if (arg == "--cores")
  ++            buildCores = getIntArg<unsigned int>(arg, i, args.end());

About your heuristic (= how to find out how many cores are doing work):

  Read this mail by Ludovic Courtès with the genius idea not to care
  about this at all. Let others do it and use nproc:
  http://thread.gmane.org/gmane.linux.distributions.nixos/4198/focus=4237

  I had a quick glance at the nproc code found coreutils.
  Result: I don't want to maintain or duplicate that.
  What you told seems to be another hint that wee should not even try to
  do so.

Regards
Marc Weber



More information about the nix-dev mailing list