diff --git a/flake.nix b/flake.nix index 06db254..1142495 100644 --- a/flake.nix +++ b/flake.nix @@ -91,7 +91,7 @@ darwinConfigurations = (import ./darwin { inherit top overlays; }); - nixosConfigurations = (import ./hosts { inherit top overlays; }); + nixosConfigurations = (import ./hosts { inherit top overlays metadata; }); homeConfigurations = (import ./home { inherit top overlays; }); diff --git a/hosts/baseline.nix b/hosts/baseline.nix index 59bff16..022290a 100644 --- a/hosts/baseline.nix +++ b/hosts/baseline.nix @@ -2,18 +2,8 @@ config, lib, pkgs, - self, ... }: -let - builderHosts = - if self != null then - (lib.attrNames ( - lib.filterAttrs (_: v: v.config.greg.remote-builder.enable) self.nixosConfigurations - )) - else - [ ]; -in { imports = [ ../modules/nix-conf.nix @@ -76,14 +66,6 @@ in }; ssh = { - extraConfig = builtins.concatStringsSep "\n" ( - lib.map (x: '' - Host ${x}-builder - Hostname ${x}.home - User remote-builder-user - '') builderHosts - ); - knownHosts = { chronicles = { extraHostNames = [ diff --git a/hosts/default.nix b/hosts/default.nix index 77bd687..b9985fd 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,4 +1,8 @@ -{ top, overlays }: +{ + top, + overlays, + metadata, +}: let vm = args: (unstable (args // { extraMods = [ top.nixos-generators.nixosModules.all-formats ]; })); wsl = args: (unstable (args // { extraMods = [ top.wsl.nixosModules.wsl ]; })); @@ -12,8 +16,7 @@ let }: channel.lib.nixosSystem { specialArgs = { - inherit top; - inherit (top) self; + inherit metadata top; }; modules = [ { diff --git a/modules/nix-conf.nix b/modules/nix-conf.nix index 6b89cb1..671dc15 100644 --- a/modules/nix-conf.nix +++ b/modules/nix-conf.nix @@ -1,11 +1,13 @@ { config, lib, + metadata, pkgs, ... }: let + builderHosts = lib.filterAttrs (_n: v: (builtins.hasAttr "builder" v) && v.builder) metadata.hosts; cfg = config.greg.nix; in { @@ -17,7 +19,20 @@ in }; config = { + programs.ssh.extraConfig = builtins.concatStringsSep "\n" ( + lib.map (x: '' + Host ${x}-builder + Hostname ${x}.shire-zebra.ts.net + User remote-builder-user + '') (lib.attrNames builderHosts) + ); + nix = { + buildMachines = lib.mapAttrsToList (k: v: { + inherit (v) systems; + hostName = "${k}.shire-zebra.ts.net"; + }) builderHosts; + distributedBuilds = true; gc = { automatic = true; # Scheduling of them is different in nixos vs nix-darwin, so check for diff --git a/network.json b/network.json index 597d7b1..a3f4cde 100644 --- a/network.json +++ b/network.json @@ -12,39 +12,53 @@ }, "exodus": { "ip": null, - "ts": "100.80.99.48" + "ts": "100.80.99.48", + "system": "x86_64-linux" }, "genesis": { "ip": "10.42.1.5", - "ts": "100.88.91.27" + "ts": "100.88.91.27", + "system": "x86_64-linux" }, "hosea": { "ip": "10.42.1.7", - "ts": "100.68.203.1" + "ts": "100.68.203.1", + "system": "x86_64-linux" }, "isaiah": { + "builder": true, "ip": "10.42.1.6", - "ts": "100.84.183.79" + "ts": "100.84.183.79", + "system": "x86_64-linux", + "systems": [ "x86_64-linux", "aarch64-linux" ] }, "jeremiah": { + "builder": true, "ip": "10.42.1.8", - "ts": "100.102.186.39" + "ts": "100.102.186.39", + "system": "x86_64-linux", + "systems": [ "x86_64-linux", "aarch64-linux" ] }, "joel": { "ip": "10.42.0.4", - "ts": null + "ts": null, + "system": "x86_64-linux" }, "linode": { "ip": null, - "ts": "100.109.86.8" + "ts": "100.109.86.8", + "system": "x86_64-linux" }, "nas1": { "ip": "10.42.1.14", "ts": "100.114.187.61" }, "zeke": { + "builder": true, "ip": "10.42.1.13", - "ts": "100.90.74.19" + "ts": "100.90.74.19", + "system": "x86_64-linux", + "systems": [ "x86_64-linux", "aarch64-linux" ] } } }