refactor CI and remote builders

This commit is contained in:
zowoq 2024-11-21 13:36:17 +10:00
parent e440957970
commit 4ecf12712b
5 changed files with 44 additions and 35 deletions

View file

@ -6,27 +6,21 @@ in
sops.secrets.id_buildfarm = { }; sops.secrets.id_buildfarm = { };
nix.distributedBuilds = true; nix.distributedBuilds = true;
nix.buildMachines = [ nix.buildMachines =
{ map
hostName = "build04.nix-community.org"; (x: {
maxJobs = 80; hostName = "${x.config.networking.hostName}.nix-community.org";
protocol = "ssh-ng"; maxJobs = x.config.nix.settings.max-jobs;
sshKey = config.sops.secrets.id_buildfarm.path; protocol = "ssh-ng";
sshUser = "nix"; sshKey = config.sops.secrets.id_buildfarm.path;
systems = [ "aarch64-linux" ]; sshUser = "nix";
supportedFeatures = nixosConfigurations.build04.config.nix.settings.system-features; systems = [
} x.config.nixpkgs.hostPlatform.system
{ ] ++ (x.config.nix.settings.extra-platforms or [ ]);
hostName = "darwin02.nix-community.org"; supportedFeatures = x.config.nix.settings.system-features;
maxJobs = 8; })
protocol = "ssh-ng"; [
sshKey = config.sops.secrets.id_buildfarm.path; darwinConfigurations.darwin02
sshUser = "nix"; nixosConfigurations.build04
systems = [
"aarch64-darwin"
"x86_64-darwin"
]; ];
supportedFeatures = darwinConfigurations.darwin02.config.nix.settings.system-features;
}
];
} }

View file

@ -3,6 +3,14 @@
inputs, inputs,
... ...
}: }:
let
buildSystems =
[
config.nixpkgs.hostPlatform.system
]
++ config.nix.settings.extra-platforms
++ builtins.concatLists (map (host: host.systems) config.nix.buildMachines);
in
{ {
imports = [ imports = [
inputs.buildbot-nix.nixosModules.buildbot-master inputs.buildbot-nix.nixosModules.buildbot-master
@ -25,12 +33,7 @@
"zimbatm" "zimbatm"
"zowoq" "zowoq"
]; ];
buildSystems = [ inherit buildSystems;
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
domain = "buildbot.nix-community.org"; domain = "buildbot.nix-community.org";
outputsPath = "/var/www/buildbot/nix-outputs/"; outputsPath = "/var/www/buildbot/nix-outputs/";
evalMaxMemorySize = 4096; evalMaxMemorySize = 4096;

View file

@ -19,10 +19,6 @@
script = builtins.readFile "${inputs.self}/modules/shared/free-space.bash"; script = builtins.readFile "${inputs.self}/modules/shared/free-space.bash";
}; };
nixpkgs.hostPlatform = {
inherit (pkgs.hostPlatform) system;
};
nix.settings.extra-platforms = lib.mkIf (config.nixpkgs.hostPlatform.system == "x86_64-linux") [ nix.settings.extra-platforms = lib.mkIf (config.nixpkgs.hostPlatform.system == "x86_64-linux") [
(lib.mkIf (config.boot.binfmt.emulatedSystems == [ ]) "i686-linux") (lib.mkIf (config.boot.binfmt.emulatedSystems == [ ]) "i686-linux")
"x86_64-v1-linux" "x86_64-v1-linux"

View file

@ -1,4 +1,16 @@
{ pkgs, config, ... }: {
pkgs,
config,
lib,
...
}:
let
inherit (lib) concatStringsSep;
localSystems = [
"builtin"
config.nixpkgs.hostPlatform.system
] ++ config.nix.settings.extra-platforms;
in
{ {
sops.secrets.hydra-admin-password.owner = "hydra"; sops.secrets.hydra-admin-password.owner = "hydra";
sops.secrets.hydra-users.owner = "hydra"; sops.secrets.hydra-users.owner = "hydra";
@ -6,7 +18,7 @@
# hydra-queue-runner needs to read this key for remote building # hydra-queue-runner needs to read this key for remote building
sops.secrets.id_buildfarm.owner = "hydra-queue-runner"; sops.secrets.id_buildfarm.owner = "hydra-queue-runner";
nix.settings.keep-outputs = pkgs.lib.mkForce false; nix.settings.keep-outputs = lib.mkForce false;
nix.settings.allowed-uris = [ nix.settings.allowed-uris = [
"git+https:" "git+https:"
@ -42,7 +54,7 @@
'') '')
(pkgs.writeText "local" '' (pkgs.writeText "local" ''
localhost x86_64-linux,builtin - 3 1 ${pkgs.lib.concatStringsSep "," config.nix.settings.system-features} - - localhost ${concatStringsSep "," localSystems} - 3 1 ${concatStringsSep "," config.nix.settings.system-features} - -
'') '')
]; ];
hydraURL = "https://hydra.nix-community.org"; hydraURL = "https://hydra.nix-community.org";

View file

@ -9,6 +9,10 @@ let
asGB = size: toString (size * 1024 * 1024 * 1024); asGB = size: toString (size * 1024 * 1024 * 1024);
in in
{ {
nixpkgs.hostPlatform = {
inherit (pkgs.hostPlatform) system;
};
nix = { nix = {
settings.trusted-public-keys = [ settings.trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="