diff --git a/flake.nix b/flake.nix index b25cad67..4b5af39d 100644 --- a/flake.nix +++ b/flake.nix @@ -68,9 +68,6 @@ nixpkgs = import stable { system = "x86_64-linux"; }; specialArgs = inputs; - # Remote builds - machinesFile = ./machines.txt; - # Use a different Nixpkgs import on some systems nodeNixpkgs.jupiter = import unstable { system = "x86_64-linux"; }; }; diff --git a/hosts/prophet/default.nix b/hosts/prophet/default.nix index 48b648b8..5f2196a5 100644 --- a/hosts/prophet/default.nix +++ b/hosts/prophet/default.nix @@ -14,7 +14,10 @@ stateVersion = "24.05"; }; - deployment.targetHost = "42f:2737:2aed:4dee:cbe4:3c73:1918:ad9b"; + deployment = { + buildOnTarget = true; + targetHost = "42f:2737:2aed:4dee:cbe4:3c73:1918:ad9b"; + }; networking.hostId = "97a21a38"; } diff --git a/machines.txt b/machines.txt deleted file mode 100644 index c372083f..00000000 --- a/machines.txt +++ /dev/null @@ -1,5 +0,0 @@ -ssh://midas x86_64-linux -ssh://kitty x86_64-linux -ssh://detritus x86_64-linux -ssh://elder x86_64-linux -ssh://prophet aarch64-linux diff --git a/modules/home/programs/terminal/ssh/default.nix b/modules/home/programs/terminal/ssh/default.nix index 8bb73968..a154ecbe 100644 --- a/modules/home/programs/terminal/ssh/default.nix +++ b/modules/home/programs/terminal/ssh/default.nix @@ -5,17 +5,10 @@ addKeysToAgent = "yes"; compression = true; matchBlocks = { - # Personal devices - tower.hostname = "4e4:535:9d47:f367:becd:6557:458d:5b1b"; - intuos.hostname = "40e:404:a427:da33:163e:97b3:a2a3:9ed4"; - jupiter.hostname = "5ce:969c:40d1:9575:f5e:591d:c377:a20b"; - # Personal servers - midas.hostname = "538:e163:87ba:f847:3646:18b6:6b01:d8f8"; - kitty.hostname = "53f:dc2d:80c9:3ca2:4b15:ef4d:38a0:c868"; - detritus.hostname = "5dd:9cd7:f286:e2c7:4c3b:c2e1:7832:97a3"; - elder.hostname = "570:3651:7f2:c26b:bccd:725b:be00:8a18"; - prophet.hostname = "42f:2737:2aed:4dee:cbe4:3c73:1918:ad9b"; + sv1.hostname = "sv1.nixfox.ca"; + sv2.hostname = "sv2.nixfox.ca"; + mx.hostname = "mx.nixfox.ca"; # Other servers bloxel.hostname = "rtmp.bloxelcom.net"; diff --git a/modules/system/devices/networking/default.nix b/modules/system/devices/networking/default.nix index fd8e9172..6046a291 100644 --- a/modules/system/devices/networking/default.nix +++ b/modules/system/devices/networking/default.nix @@ -1,6 +1,7 @@ { config, ... }: { imports = [ + ./hosts ./mounts ./mycelium ./nameservers diff --git a/modules/system/devices/networking/hosts/default.nix b/modules/system/devices/networking/hosts/default.nix new file mode 100644 index 00000000..5f1aea5f --- /dev/null +++ b/modules/system/devices/networking/hosts/default.nix @@ -0,0 +1,10 @@ +{ config, lib, nodes, ... }: +{ + networking.hosts = with nodes; { + "${midas.config.deployment.targetHost}" = [ "midas" ]; + "${kitty.config.deployment.targetHost}" = [ "kitty" ]; + "${detritus.config.deployment.targetHost}" = [ "detritus" ]; + "${elder.config.deployment.targetHost}" = [ "elder" ]; + "${prophet.config.deployment.targetHost}" = [ "prophet" ]; + }; +} diff --git a/modules/system/devices/networking/mounts/default.nix b/modules/system/devices/networking/mounts/default.nix index b1354e42..ef41e273 100644 --- a/modules/system/devices/networking/mounts/default.nix +++ b/modules/system/devices/networking/mounts/default.nix @@ -1,41 +1,34 @@ { config, lib, nodes, ... }: { fileSystems = let - netOpts = [ - "noauto" - "soft" - "x-systemd.automount" - ]; + common = { + fsType = "nfs4"; + options = [ + "noauto" + "soft" + "x-systemd.automount" + ]; + }; in with nodes; { - "midas" = { - device = "[${midas.config.deployment.targetHost}]:/storage"; + "midas" = common // { + device = "midas:/storage"; mountPoint = "/network/Midas"; - fsType = "nfs4"; - options = netOpts; }; - "kitty" = { - device = "[${kitty.config.deployment.targetHost}]:/storage"; + "kitty" = common // { + device = "kitty:/storage"; mountPoint = "/network/Kitty"; - fsType = "nfs4"; - options = netOpts; }; - "detritus" = { - device = "[${detritus.config.deployment.targetHost}]:/storage"; + "detritus" = common // { + device = "detritus:/storage"; mountPoint = "/network/Detritus"; - fsType = "nfs4"; - options = netOpts; }; - "elder" = { - device = "[${elder.config.deployment.targetHost}]:/storage"; + "elder" = common // { + device = "elder:/storage"; mountPoint = "/network/Elder"; - fsType = "nfs4"; - options = netOpts; }; - "prophet" = { - device = "[${prophet.config.deployment.targetHost}]:/storage"; + "prophet" = common // { + device = "prophet:/storage"; mountPoint = "/network/Prophet"; - fsType = "nfs4"; - options = netOpts; }; }; } diff --git a/modules/system/settings/nix/default.nix b/modules/system/settings/nix/default.nix index 6973350b..aaf08ea3 100644 --- a/modules/system/settings/nix/default.nix +++ b/modules/system/settings/nix/default.nix @@ -2,6 +2,7 @@ { imports = [ ./channels + ./distributed ./gc ./unfree ]; @@ -14,10 +15,7 @@ "nix-command" "flakes" ]; - max-jobs = 0; - trusted-users = [ "root" ]; }; - distributedBuilds = true; }; # Use a newer implementation of nixos-rebuild diff --git a/modules/system/settings/nix/distributed/default.nix b/modules/system/settings/nix/distributed/default.nix new file mode 100644 index 00000000..210ba399 --- /dev/null +++ b/modules/system/settings/nix/distributed/default.nix @@ -0,0 +1,39 @@ +{ nodes, ... }: +{ + nix = { + buildMachines = with nodes; [ + { + hostName = midas.config.deployment.targetHost; + system = midas.config.nixpkgs.localSystem.system; + publicHostKey = "AAAAC3NzaC1lZDI1NTE5AAAAIFcFMvrx9/iUZ1mEubf+QF1i3LNTxFhaU/1zFSjdo0kK"; + protocol = "ssh-ng"; + } + { + hostName = kitty.config.deployment.targetHost; + system = kitty.config.nixpkgs.localSystem.system; + publicHostKey = "AAAAC3NzaC1lZDI1NTE5AAAAIIrGmsya5DXKuXO6jNjUlrYHqk49KLzxM/60GXtLRLrL"; + protocol = "ssh-ng"; + } + { + hostName = detritus.config.deployment.targetHost; + system = detritus.config.nixpkgs.localSystem.system; + publicHostKey = "AAAAC3NzaC1lZDI1NTE5AAAAIN+GvLro4DVmlvmXcasU1gctIX9qct7mZtElpB735AoL"; + protocol = "ssh-ng"; + } + { + hostName = elder.config.deployment.targetHost; + system = elder.config.nixpkgs.localSystem.system; + publicHostKey = "AAAAC3NzaC1lZDI1NTE5AAAAIFjmJ6bkuO57gp6GZDEfR1O7krdf5wiqrOBC5pzTDl91"; + protocol = "ssh-ng"; + } + { + hostName = prophet.config.deployment.targetHost; + system = prophet.config.nixpkgs.localSystem.system; + publicHostKey = "AAAAC3NzaC1lZDI1NTE5AAAAICrp3Y/X2BRUENx+0GMTmB1VDA6SiwkGgdJMHSdMMepM"; + protocol = "ssh-ng"; + } + ]; + distributedBuilds = true; + settings.trusted-users = [ "root" ]; + }; +}