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

View file

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

View file

@ -19,10 +19,6 @@
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") [
(lib.mkIf (config.boot.binfmt.emulatedSystems == [ ]) "i686-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-users.owner = "hydra";
@ -6,7 +18,7 @@
# hydra-queue-runner needs to read this key for remote building
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 = [
"git+https:"
@ -42,7 +54,7 @@
'')
(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";

View file

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