[General/Nix] Improve remote builders support

This commit is contained in:
Antoine Viallon 2022-10-21 23:48:34 +02:00
parent 52d7d35514
commit 0d927b6971
Signed by: aviallon
GPG key ID: 186FC35EDEB25716

View file

@ -11,23 +11,26 @@ let
mkBuildMachine = { mkBuildMachine = {
hostName, hostName,
cores, cores,
system ? "x86_64-linux" ,
threads ? (cores * 2), threads ? (cores * 2),
features ? [ ], features ? [ ],
x86ver ? 1 x86ver ? 1 ,
}: ...
rec { }@attrs: rec {
inherit hostName; inherit hostName system;
system = "x86_64-linux";
maxJobs = cores / 2;
sshUser = "builder"; sshUser = "builder";
sshKey = toString buildUserKeyFile; sshKey = toString buildUserKeyFile;
speedFactor = getSpeed cores threads; speedFactor = getSpeed cores threads;
maxJobs = myLib.math.log2 cores;
supportedFeatures = [ "kvm" "benchmark" ] supportedFeatures = [ "kvm" "benchmark" ]
++ optional (system == "x86_64-linux") "i686-linux"
++ optional (speedFactor > 8) "big-parallel" ++ optional (speedFactor > 8) "big-parallel"
++ optional (x86ver >= 2) "gccarch-x86-64-v2" ++ optional (x86ver >= 2) "gccarch-x86-64-v2"
++ optional (x86ver >= 3) "gccarch-x86-64-v3" ++ optional (x86ver >= 3) "gccarch-x86-64-v3"
++ optional (x86ver >= 4) "gccarch-x86-64-v4"
++ features ++ features
; ;
}; };
in in
{ {
@ -123,14 +126,23 @@ in
}; };
nix.buildMachines = [ nix.buildMachines = [
{ (mkBuildMachine {
hostName = "lesviallon.fr"; hostName = "luke-skywalker-nixos.local";
system = "x86_64-linux"; cores = 8;
maxJobs = 2; threads = 16;
speedFactor = 4; })
supportedFeatures = [ "kvm" "benchmark" "big-parallel" ]; (mkBuildMachine {
} hostName = "cachan.lesviallon.fr";
cores = 6;
threads = 6;
})
]; ];
programs.ssh.extraConfig = ''
Host cachan.lesviallon.fr
Port 52222
'';
users.users.builder = { users.users.builder = {
isSystemUser = true; isSystemUser = true;
group = "builder"; group = "builder";