nixos/hosts/common/optional/distributed_builds/local-machine.nix

44 lines
1.1 KiB
Nix
Raw Normal View History

2025-01-08 13:02:55 +00:00
{ pkgs, configVars, ... }:
let
remoteMachineIp = configVars.networking.addresses.remote-builder.ip;
in
2025-01-08 11:59:40 +00:00
{
2025-01-08 13:02:55 +00:00
nix.distributedBuilds = true;
nix.settings.builders-use-substitutes = true;
2025-01-08 19:25:16 +00:00
nix.settings.max-jobs = 0;
nix.settings.trusted-substituters = ["ssh://${remoteMachineIp}"];
nix.settings.substituters = ["ssh://${remoteMachineIp}"];
2025-01-08 13:02:55 +00:00
nix.buildMachines = [
{
2025-01-08 20:00:36 +00:00
hostName = "remotebuild@${remoteMachineIp}";
speedFactor = 1;
maxJobs = 10;
2025-01-08 13:02:55 +00:00
sshKey = "/root/.ssh/remotebuild";
system = pkgs.stdenv.hostPlatform.system;
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
2025-01-08 13:02:55 +00:00
}
];
# TODO: set known host here when have static ip on main server
# programs.ssh.knownHosts = {
# "merlin" = {
# publicKey = "server pubkey";
# };
# };
2025-01-08 20:00:36 +00:00
programs.ssh.extraConfig = ''
Host ${remoteMachineIp}
Port 22
User remotebuild
IdentitiesOnly yes
IdentityFile /root/.ssh/remotebuild
'';
2025-01-08 20:02:59 +00:00
2025-01-08 12:15:11 +00:00
sops.secrets = {
2025-01-08 11:59:40 +00:00
"ssh_keys/root/remotebuild" = {
path = "/root/.ssh/remotebuild";
};
};
}