summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hosts/tomato/default.nix2
-rw-r--r--modules/build-machines.nix32
-rw-r--r--modules/default.nix1
3 files changed, 35 insertions, 0 deletions
diff --git a/hosts/tomato/default.nix b/hosts/tomato/default.nix
index 16c5ac5..0e7d146 100644
--- a/hosts/tomato/default.nix
+++ b/hosts/tomato/default.nix
@@ -28,6 +28,8 @@
services.joycond.enable = true;
+ this.buildMachines = ["pinto"];
+
this.hosts = {
lan.home = true;
mine = true;
diff --git a/modules/build-machines.nix b/modules/build-machines.nix
new file mode 100644
index 0000000..12409db
--- /dev/null
+++ b/modules/build-machines.nix
@@ -0,0 +1,32 @@
+{lib, config, ...}:
+
+let
+ machines = {
+ pinto = {
+ maxJobs = 2;
+ protocol = "ssh-ng";
+ supportedFeatures = ["big-parallel" "kvm"];
+ };
+ };
+ enabled = config.this.buildMachines;
+
+ inherit (lib.attrsets) filterAttrs;
+in
+{
+ options = {
+ this.buildMachines = lib.mkOption {
+ type = with lib.types; listOf str;
+ default = [];
+ };
+ };
+
+ config = {
+ nix.buildMachines = builtins.map
+ (m: machines."${m}" // { hostName = m; })
+ enabled;
+ nix.distributedBuilds = (enabled == []);
+ nix.extraOptions = lib.mkIf (enabled != []) ''
+ builders-use-substitutes = true
+ '';
+ };
+}
diff --git a/modules/default.nix b/modules/default.nix
index 36c6f66..06f0fb3 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -14,6 +14,7 @@
./hosts.nix
./bluetooth.nix
./unfree.nix
+ ./build-machines.nix
./overlays
];