* New configuration setting `build-max-jobs' which sets the default
for the `-j' flag (i.e., the maximum number of jobs to execute in parallel). Useful on multi-processor machines.
This commit is contained in:
parent
3e239a37ff
commit
d19b6521fc
|
@ -68,6 +68,16 @@
|
||||||
#env-keep-derivations = false
|
#env-keep-derivations = false
|
||||||
|
|
||||||
|
|
||||||
|
### Option `build-max-jobs'
|
||||||
|
#
|
||||||
|
# This option defines the maximum number of jobs that Nix will try to
|
||||||
|
# build in parallel. The default is 1. You should generally set it
|
||||||
|
# to the number of CPUs in your system (e.g., 2 on a Athlon 64 X2).
|
||||||
|
# It can be overriden using the `--max-jobs' / `-j' command line
|
||||||
|
# switch.
|
||||||
|
#build-max-jobs = 1
|
||||||
|
|
||||||
|
|
||||||
### Option `build-allow-root'
|
### Option `build-allow-root'
|
||||||
#
|
#
|
||||||
# This option controls Nix's behaviour when it is invoked under the
|
# This option controls Nix's behaviour when it is invoked under the
|
||||||
|
|
|
@ -94,7 +94,14 @@ static void initAndRun(int argc, char * * argv)
|
||||||
nixConfDir = canonPath(getEnv("NIX_CONF_DIR", NIX_CONF_DIR));
|
nixConfDir = canonPath(getEnv("NIX_CONF_DIR", NIX_CONF_DIR));
|
||||||
nixLibexecDir = canonPath(getEnv("NIX_LIBEXEC_DIR", NIX_LIBEXEC_DIR));
|
nixLibexecDir = canonPath(getEnv("NIX_LIBEXEC_DIR", NIX_LIBEXEC_DIR));
|
||||||
|
|
||||||
|
/* Get some settings from the configuration file. */
|
||||||
thisSystem = querySetting("system", SYSTEM);
|
thisSystem = querySetting("system", SYSTEM);
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
if (!string2Int(querySetting("build-max-jobs", "1"), n) || n < 0)
|
||||||
|
throw Error("invalid value for configuration setting `build-max-jobs'");
|
||||||
|
maxBuildJobs = n;
|
||||||
|
}
|
||||||
|
|
||||||
/* Catch SIGINT. */
|
/* Catch SIGINT. */
|
||||||
struct sigaction act, oact;
|
struct sigaction act, oact;
|
||||||
|
|
Loading…
Reference in a new issue