diff --git a/hosts/citadel/default.nix b/hosts/citadel/default.nix index a563781..f1d1684 100644 --- a/hosts/citadel/default.nix +++ b/hosts/citadel/default.nix @@ -57,6 +57,9 @@ in { ../common/optional/gaming.nix ../common/optional/powersave.nix ../common/optional/restic-backup.nix + + # This machine is used for remote building + ../common/optional/distributed_builds/remote-builder-machine.nix ]; boot = { diff --git a/hosts/common/optional/distributed_builds/local-machine.nix b/hosts/common/optional/distributed_builds/local-machine.nix new file mode 100644 index 0000000..f24f49a --- /dev/null +++ b/hosts/common/optional/distributed_builds/local-machine.nix @@ -0,0 +1,7 @@ +{ + secrets = { + "ssh_keys/root/remotebuild" = { + path = "/root/.ssh/remotebuild"; + }; + }; +} diff --git a/hosts/common/optional/distributed_builds/remote-builder-machine.nix b/hosts/common/optional/distributed_builds/remote-builder-machine.nix new file mode 100644 index 0000000..e472374 --- /dev/null +++ b/hosts/common/optional/distributed_builds/remote-builder-machine.nix @@ -0,0 +1,18 @@ +{ + secrets = { + "ssh_keys/root/remotebuild.pub" = { + path = "/root/.ssh/remotebuild.pub"; + }; + }; + users.users.remotebuild = { + isNormalUser = true; + createHome = false; + group = "remotebuild"; + + openssh.authorizedKeys.keyFiles = [/root/.ssh/remotebuild.pub]; + }; + + users.groups.remotebuild = {}; + + nix.settings.trusted-users = ["remotebuild"]; +} diff --git a/hosts/semita/default.nix b/hosts/semita/default.nix index 55cf4a1..bcf6d82 100644 --- a/hosts/semita/default.nix +++ b/hosts/semita/default.nix @@ -18,7 +18,6 @@ pieholeIp = configVars.networking.addresses.piehole.ip; gatewayIp = configVars.networking.addresses.gateway.ip; semitaIp = configVars.networking.addresses.semita.ip; - in { imports = [ # Create users for this host @@ -84,6 +83,25 @@ in { }; }; + nix.distributedBuilds = true; + nix.buildMachines = [ + { + hostName = "builder"; + systems = ["x86_64-linux"]; + maxJobs = 8; + speedFactor = 2; + supportedFeatures = ["nixos-test" "benchmark" "big-parallel" "kvm"]; + } + ]; + programs.ssh.extraConfig = '' + Host builder + HostName 192.10.99.14 + Port 2222 + User builder + IdentitiesOnly yes + IdentityFile /root/.ssh/id_builder + ''; + environment.variables = { GDK_SCALE = "2"; GDK_DPI_SCALE = "0.6"; @@ -96,10 +114,12 @@ in { pkgs.sof-firmware ]; - swapDevices = [ { - device = "/.swapvol/swapfile"; - size = 32*1024; - } ]; + swapDevices = [ + { + device = "/.swapvol/swapfile"; + size = 32 * 1024; + } + ]; # Add hardware support for intel gpus as specified here: https://nixos.wiki/wiki/Jellyfin nixpkgs.config.packageOverrides = pkgs: {