summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--machines/bismuth/default.nix8
-rw-r--r--modules/nix.nix77
2 files changed, 55 insertions, 30 deletions
diff --git a/machines/bismuth/default.nix b/machines/bismuth/default.nix
index f8d6b51..448ea21 100644
--- a/machines/bismuth/default.nix
+++ b/machines/bismuth/default.nix
@@ -12,14 +12,6 @@
 
   networking.hostName = "Bismuth";
 
-  # run binary cache for slower machines
-  services.nix-serve = {
-    enable = true;
-    # note: can we get this value from somewhere?
-    bindAddress = "100.85.58.31"; # bismuth tailnet ip
-    secretKeyFile = "/var/bismuth-cache.pem";
-  };
-
   # expose vm web interface to tailnet
   services.tailscale.extraUpFlags = [
     "--advertise-routes=192.168.122.100/32"
diff --git a/modules/nix.nix b/modules/nix.nix
index a98ec18..13572c5 100644
--- a/modules/nix.nix
+++ b/modules/nix.nix
@@ -1,24 +1,10 @@
-{ me, lib, self, ... }:
-
-let
-  # NOTE: disable te bismuth cache for now,
-  # when bismuth is offline it still hangs,
-  # maybe use corsac and let bismuth write to it?
-  #useBismuthCache = (me != "bismuth");
-  useBismuthCache = false;
-
-  # nixos by default likes to place the default cache
-  # at the end, but bismuth is often offline, and the
-  # default cache should be preferred if it has the
-  # necessary derivation
-  mkPostfix = x: lib.mkOrder 2000 x;
-
-  bismuthCacheSettings = { 
-    substituters = mkPostfix [ "http://bismuth.serval-moth.ts.net:5000" ];
-    trusted-public-keys = [ "bismuth-1:XW9nsNsccipbmdfchyb3YIIWNT058iSpHLwlj1xgB7A=" ];
-  };
+{
+  me,
+  lib,
+  self,
+  ...
+}:
 
-in
 {
   nix = {
     # add compat scripts to the environment,
@@ -29,7 +15,54 @@ in
     ];
 
     settings = {
-      experimental-features = [ "flakes" "nix-command" ];
-    } // lib.optionalAttrs useBismuthCache bismuthCacheSettings; # use bismuth cache
+      experimental-features = [
+        "flakes"
+        "nix-command"
+      ];
+      trusted-users = [
+        "root"
+        "mel"
+      ];
+    };
+
+    distributedBuilds = true;
+    buildMachines =
+      let
+        tailnet = n: "${n}.serval-moth.ts.net";
+
+        defaults = {
+          sshUser = "mel";
+          system = "x86_64-linux";
+          supportedFeatures = [
+            "kvm"
+            "big-parallel"
+            "nixos-test"
+            "benchmark"
+          ];
+        };
+      in
+      lib.filter (m: m.hostName != me) [
+        {
+          hostName = tailnet "bismuth";
+          maxJobs = 16;
+          speedFactor = 5;
+          publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUVQMVE4LzA3UEQ1QVhnaE03Y2Q5VWY1NFlZOHJrdUJIZmxscjFLenhoMTAgcm9vdEBiaXNtdXRoCg==";
+          inherit (defaults) sshUser system supportedFeatures;
+        }
+        {
+          hostName = tailnet "corsac";
+          maxJobs = 4;
+          speedFactor = 2;
+          publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUh4Z2hWWDBPcStlSGtsZy9lN3MvcWhDOENLOFBMVWd2cExrMkc1M3hFaksgcm9vdEBjb3JzYWMK";
+          inherit (defaults) sshUser system supportedFeatures;
+        }
+        {
+          hostName = tailnet "renard";
+          maxJobs = 6;
+          speedFactor = 3;
+          publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUovcURMNys4NiswSDZOa1BzL3c0R1lpV1F3VC80WUF4OU8ySjdzTGtLbWYgcm9vdEByZW5hcmQK";
+          inherit (defaults) sshUser system supportedFeatures;
+        }
+      ];
   };
 }