Commit 6351370b9d8f

Vincent Demeester <vincent@sbr.pm>
2018-12-27 14:13:24
nix-config: add buildCores configuration
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent e6c09ce
machine/carthage.nix
@@ -12,6 +12,7 @@ with import ../assets/machines.nix; {
   profiles = {
     git.enable = true;
     nix-config.localCaches = [];
+    nix-config.buildCores = 1;
     nix-auto-update.autoUpgrade = false;
     ssh.enable = true;
     syncthing.enable = true;
machine/hokkaido.nix
@@ -15,6 +15,7 @@ with import ../assets/machines.nix; {
     ssh.enable = true;
     syncthing.enable = true;
     virtualization.enable = true;
+    nix-config.buildCores = 2;
   };
   networking.firewall.allowPing = true;
   services = {
machine/honshu.nix
@@ -11,6 +11,7 @@ with import ../assets/machines.nix; {
   profiles = {
     avahi.enable = true;
     dev.enable = true;
+    nix-config.buildCores = 4;
     ssh.enable = true;
     syncthing.enable = true;
   };
machine/kerkouane.nix
@@ -10,6 +10,7 @@ with import ../assets/machines.nix; {
   profiles = {
     git.enable = true;
     nix-config.localCaches = [];
+    nix-config.buildCores = 1;
     nix-auto-update.autoUpgrade = false;
     ssh.enable = true;
     wireguard.server.enable = true;
machine/kobe.nix
@@ -30,6 +30,7 @@ with import ../assets/machines.nix; {
   profiles = {
     avahi.enable = true;
     git.enable = true;
+    nix-config.buildCores = 1;
     ssh.enable = true;
   };
   networking.firewall.allowPing = true;
machine/massimo.nix
@@ -13,6 +13,7 @@ with import ../assets/machines.nix; {
   profiles = {
     avahi.enable = true;
     git.enable = true;
+    nix-config.buildCores = 4;
     ssh.enable = true;
     syncthing.enable = true;
   };
machine/shikoku.nix
@@ -14,6 +14,7 @@ with import ../assets/machines.nix; {
     dev.enable = true;
     docker.enable = true;
     gaming.enable = true;
+    nix-config.buildCores = 4;
     ssh.enable = true;
     virtualization.enable = true;
   };
machine/wakasu.nix
@@ -8,6 +8,7 @@ with import ../assets/machines.nix; {
     dev.enable = true;
     docker.enable = true;
     laptop.enable = true;
+    nix-config.buildCores = 4;
     ssh.enable = true;
     virtualization.enable = true;
   };
modules/profiles/nix-config.nix
@@ -22,6 +22,14 @@ in
         description = "Number of day to keep when garbage collect";
         type = types.str;
       };
+      buildCores = mkOption {
+        type = types.int;
+        default = 2;
+        example = 4;
+        description = ''
+          Maximum number of concurrent tasks during one build.
+        '';
+      };
       localCaches = mkOption {
         default = [ "http://nix.cache.home" ];
         description = "List of local nix caches";
@@ -31,6 +39,7 @@ in
   };
   config = mkIf cfg.enable {
     nix = {
+      buildCores = cfg.buildCores;
       useSandbox = true;
       gc = {
         automatic = true;