summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2020-04-09 00:36:14 +0200
committerGitHub <noreply@github.com>2020-04-09 00:36:14 +0200
commit2577ec293255cbb995e42a86169cc40c427a6e7d (patch)
tree722d6267d95de4ab325266a990a6f0c4bcc560ff /nixos
parentf49114b6333104dd357be6cf856f90fba1d25a52 (diff)
parente6a15db534d18d0eefb5916ee87b4951d51af2cf (diff)
downloadnixpkgs-2577ec293255cbb995e42a86169cc40c427a6e7d.tar
nixpkgs-2577ec293255cbb995e42a86169cc40c427a6e7d.tar.gz
nixpkgs-2577ec293255cbb995e42a86169cc40c427a6e7d.tar.bz2
nixpkgs-2577ec293255cbb995e42a86169cc40c427a6e7d.tar.lz
nixpkgs-2577ec293255cbb995e42a86169cc40c427a6e7d.tar.xz
nixpkgs-2577ec293255cbb995e42a86169cc40c427a6e7d.tar.zst
nixpkgs-2577ec293255cbb995e42a86169cc40c427a6e7d.zip
Merge pull request #84570 from Mic92/max-jobs
nixos: default nix.maxJobs to auto
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/installer/tools/nixos-generate-config.pl4
-rw-r--r--nixos/modules/services/misc/nix-daemon.nix11
2 files changed, 6 insertions, 9 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index 629c56814a1..a32c19a4eba 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -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
 if (-e "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors") {
@@ -562,7 +559,6 @@ my $hwConfig = <<EOF;
   boot.kernelModules = [$kernelModules ];
   boot.extraModulePackages = [$modulePackages ];
 $fsAndSwap
-  nix.maxJobs = lib.mkDefault $cpus;
 ${\join "", (map { "  $_\n" } (uniq @attrs))}}
 EOF
 
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index 8203cb13e50..e14df310ae8 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -92,13 +92,14 @@ in
 
       maxJobs = mkOption {
         type = types.either types.int (types.enum ["auto"]);
-        default = 1;
+        default = "auto";
         example = 64;
         description = ''
-          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 total number of logical cores in your system (e.g., 16
-          for two CPUs with 4 cores each and hyper-threading).
+          This option defines the maximum number of jobs that Nix will try to
+          build in parallel. The default is auto, which means it will use all
+          available logical cores. It is recommend to set it to the total
+          number of logical cores in your system (e.g., 16 for two CPUs with 4
+          cores each and hyper-threading).
         '';
       };