buildbot-nix/examples/default.nix

62 lines
1.9 KiB
Nix
Raw Permalink Normal View History

2023-09-15 07:10:02 +00:00
{ nixpkgs, system, buildbot-nix, ... }:
2023-09-10 09:16:51 +00:00
let
# some example configuration to make it eval
dummy = { config, ... }: {
2023-09-10 11:16:33 +00:00
config = {
networking.hostName = "example-common";
system.stateVersion = config.system.nixos.version;
users.users.root.initialPassword = "fnord23";
2023-09-13 21:31:20 +00:00
boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ];
fileSystems."/".device = lib.mkDefault "/dev/sda";
2023-09-10 11:16:33 +00:00
};
2023-09-10 09:16:51 +00:00
};
inherit (nixpkgs) lib;
inherit (lib) nixosSystem;
in
{
2024-04-15 13:28:27 +00:00
# This runs both master and worker on the same machine.
# As the actual build is offloaded with remote builder,
# this also works well for production setups.
"example-master-worker-combined-${system}" = nixosSystem {
inherit system;
modules = [
dummy
buildbot-nix.nixosModules.buildbot-master
buildbot-nix.nixosModules.buildbot-worker
./master.nix
./worker.nix
];
};
2023-09-15 07:10:02 +00:00
"example-master-${system}" = nixosSystem {
2023-09-10 09:16:51 +00:00
inherit system;
modules = [
dummy
buildbot-nix.nixosModules.buildbot-master
2024-04-15 13:28:27 +00:00
./master.nix
# When master and worker run on different machines,
# we need to configure the master to listen on a public address.
# Also check out the buildbot upstream documentation on the master-worker protocol,
# including tls encryption
{
# exposes the master build protocol on port 9989
services.buildbot-master.extraConfig = ''
c["protocols"] = {"pb": {"port": "tcp:9989:interface=\\:\\:"}}
'';
networking.firewall.allowedTCPPorts = [ 9989 ];
}
2023-09-10 09:16:51 +00:00
];
};
2024-04-15 13:28:27 +00:00
2023-09-15 07:10:02 +00:00
"example-worker-${system}" = nixosSystem {
2023-09-10 09:16:51 +00:00
inherit system;
modules = [
dummy
buildbot-nix.nixosModules.buildbot-worker
2024-04-15 13:28:27 +00:00
./worker.nix
# Connects to a master on the ipv6 address 2a09:80c0:102::1
{ services.buildbot-nix.worker.masterUrl = ''tcp:host=2a09\:80c0\:102\:\:1:port=9989''; }
2023-09-10 09:16:51 +00:00
];
};
}