Merge pull request #84570 from Mic92/max-jobs
nixos: default nix.maxJobs to auto
This commit is contained in:
commit
2577ec2932
@ -91,9 +91,6 @@ sub hasCPUFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Detect the number of CPU cores.
|
|
||||||
my $cpus = scalar (grep {/^processor\s*:/} (split '\n', $cpuinfo));
|
|
||||||
|
|
||||||
|
|
||||||
# Determine CPU governor to use
|
# Determine CPU governor to use
|
||||||
if (-e "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors") {
|
if (-e "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors") {
|
||||||
@ -562,7 +559,6 @@ my $hwConfig = <<EOF;
|
|||||||
boot.kernelModules = [$kernelModules ];
|
boot.kernelModules = [$kernelModules ];
|
||||||
boot.extraModulePackages = [$modulePackages ];
|
boot.extraModulePackages = [$modulePackages ];
|
||||||
$fsAndSwap
|
$fsAndSwap
|
||||||
nix.maxJobs = lib.mkDefault $cpus;
|
|
||||||
${\join "", (map { " $_\n" } (uniq @attrs))}}
|
${\join "", (map { " $_\n" } (uniq @attrs))}}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -92,13 +92,14 @@ in
|
|||||||
|
|
||||||
maxJobs = mkOption {
|
maxJobs = mkOption {
|
||||||
type = types.either types.int (types.enum ["auto"]);
|
type = types.either types.int (types.enum ["auto"]);
|
||||||
default = 1;
|
default = "auto";
|
||||||
example = 64;
|
example = 64;
|
||||||
description = ''
|
description = ''
|
||||||
This option defines the maximum number of jobs that Nix will try
|
This option defines the maximum number of jobs that Nix will try to
|
||||||
to build in parallel. The default is 1. You should generally
|
build in parallel. The default is auto, which means it will use all
|
||||||
set it to the total number of logical cores in your system (e.g., 16
|
available logical cores. It is recommend to set it to the total
|
||||||
for two CPUs with 4 cores each and hyper-threading).
|
number of logical cores in your system (e.g., 16 for two CPUs with 4
|
||||||
|
cores each and hyper-threading).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user