diff --git a/hosts/focalor/default.nix b/hosts/focalor/default.nix index 509f6b8..3a3eebd 100644 --- a/hosts/focalor/default.nix +++ b/hosts/focalor/default.nix @@ -51,7 +51,10 @@ in }; boot.kernel.sysctl."net.ipv4.ip_forward" = 1; nix.settings = { - trusted-users = lib.mkForce [ "root" ]; + trusted-users = lib.mkForce [ + "root" + "nixremote" + ]; extra-platforms = [ "aarch64-linux" ]; extra-substituters = [ "https://noctalia.cachix.org" diff --git a/hosts/focalor/modules/nix-builder.nix b/hosts/focalor/modules/nix-builder.nix new file mode 100644 index 0000000..8f24e52 --- /dev/null +++ b/hosts/focalor/modules/nix-builder.nix @@ -0,0 +1,13 @@ +# Builds for valefar: its nix-daemon connects as nixremote with the key in valefar's /etc/nix/builder_ed25519 +# (see hosts/valefar/remote-builder.nix), so valefar's CPU stays free for bonsai. +{ + users.groups.nixremote = { }; + users.users.nixremote = { + isSystemUser = true; + group = "nixremote"; + useDefaultShell = true; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHVC/SxLmrLMA9hs4l/x3Et7OSYFujYzPCTTipycOvnl valefar nix builder" + ]; + }; +} diff --git a/hosts/valefar/default.nix b/hosts/valefar/default.nix index 4dfe6e7..b134e3c 100644 --- a/hosts/valefar/default.nix +++ b/hosts/valefar/default.nix @@ -22,6 +22,7 @@ ./wg-mesh.nix ./bonsai.nix ./open-webui.nix + ./remote-builder.nix ./spindle.nix ]; diff --git a/hosts/valefar/remote-builder.nix b/hosts/valefar/remote-builder.nix new file mode 100644 index 0000000..1d5f6df --- /dev/null +++ b/hosts/valefar/remote-builder.nix @@ -0,0 +1,36 @@ +# Builds go to focalor (16 cores, same nixpkgs) so valefar's CPU stays free for bonsai. focalor dual-boots: when it +# is on Windows the connection times out after 3 s and nix builds here as before. +{ + programs.ssh.extraConfig = '' + Host focalor-builder + HostName 10.0.0.43 + User nixremote + IdentityFile /etc/nix/builder_ed25519 + ConnectTimeout 3 + ''; + programs.ssh.knownHosts.focalor = { + hostNames = [ + "focalor-builder" + "10.0.0.43" + ]; + publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMc9KcnDJ10ZwivfADacqltLDHbIw/jawkGsN9HCUO+h"; + }; + + nix = { + distributedBuilds = true; + buildMachines = [ + { + hostName = "focalor-builder"; + protocol = "ssh-ng"; + system = "x86_64-linux"; + maxJobs = 2; + speedFactor = 4; + supportedFeatures = [ + "big-parallel" + "benchmark" + ]; + } + ]; + settings.builders-use-substitutes = true; + }; +}