distributed-build: move to modules/config/nix

Signed-off-by: unexplrd <unexplrd@linerds.us>
This commit is contained in:
2025-06-11 13:10:20 +03:00
parent 0db2cbfe19
commit e828500be7
12 changed files with 53 additions and 141 deletions

View File

@ -1,6 +1,7 @@
{
imports = [
./common.nix
./distibuted-build.nix
./substituters.nix
];
}

View File

@ -0,0 +1,47 @@
{
config,
inputs,
lib,
...
}: let
isBuildHost = config.networking.hostName == "dunamis";
in {
config = lib.mkMerge [
(lib.mkIf isBuildHost {
nix = let
inherit (builtins) readFile;
inherit (config.users.users) user;
in {
sshServe = {
enable = true;
keys = map (f: readFile f) user.openssh.authorizedKeys.keyFiles;
# protocol = "ssh-ng";
trusted = true;
write = true;
};
};
security.pam.sshAgentAuth.enable = true;
})
(lib.mkIf (!isBuildHost) {
nix = let
inherit (builtins) readFile;
inherit (config.networking) hostName;
inherit (config.sops) secrets;
inherit (inputs) mysecrets;
pubHost = readFile "${mysecrets}/ssh/ssh_host_ed25519_dunamis.base64";
in {
distributedBuilds = true;
buildMachines = [
{
hostName = "dunamis";
system = "x86_64-linux";
publicHostKey = pubHost;
sshKey = secrets."ssh-${hostName}-user".path;
sshUser = "nix-ssh";
supportedFeatures = ["benchmark" "big-parallel" "kvm" "nixos-test"];
}
];
};
})
];
}