shared-public-infra/modules/buildbot/default.nix

60 lines
1.8 KiB
Nix
Raw Permalink Normal View History

2023-08-07 12:46:46 +00:00
{ lib, pkgs, config, inputs, ... }:
2023-07-23 11:44:48 +00:00
with lib;
let
cfg = config.luj.buildbot;
port = "1810";
package = pkgs.buildbot-worker;
python = package.pythonModule;
home = "/var/lib/buildbot-worker";
buildbotDir = "${home}/worker";
in
{
#buildbot worker
2023-08-21 11:57:34 +00:00
# nix.settings.allowed-users = [ "buildbot-worker" ];
2023-08-07 12:46:46 +00:00
nix.settings.trusted-users = [ "buildbot-worker" ];
2023-07-23 11:44:48 +00:00
users.users.buildbot-worker = {
description = "Buildbot Worker User.";
isSystemUser = true;
createHome = true;
home = "/var/lib/buildbot-worker";
group = "buildbot-worker";
useDefaultShell = true;
};
users.groups.buildbot-worker = { };
systemd.services.buildbot-worker = {
reloadIfChanged = true;
description = "Buildbot Worker.";
after = [ "network.target" "buildbot-master.service" ];
wantedBy = [ "multi-user.target" ];
path = [
2023-08-01 14:48:49 +00:00
pkgs.nix-eval-jobs
2023-07-23 11:44:48 +00:00
pkgs.git
pkgs.gh
pkgs.nix
pkgs.nix-output-monitor
2023-08-07 12:46:46 +00:00
inputs.attic.packages.x86_64-linux.attic
2023-07-23 11:44:48 +00:00
];
environment.PYTHONPATH = "${python.withPackages (_: [package])}/${python.sitePackages}";
2023-08-01 14:48:49 +00:00
environment.MASTER_URL = ''TCP:2a01\\:e34\\:ec2a\\:8e60\\:8ec7\\:b5d2\\:f663\\:a67a:9989'';
2023-07-23 11:44:48 +00:00
environment.BUILDBOT_DIR = buildbotDir;
environment.WORKER_PASSWORD_FILE = "/var/lib/buildbot-worker/password.txt";
serviceConfig = {
Type = "simple";
User = "buildbot-worker";
Group = "buildbot-worker";
WorkingDirectory = home;
# Restart buildbot with a delay. This time way we can use buildbot to deploy itself.
ExecReload = "+${pkgs.systemd}/bin/systemd-run --on-active=60 ${pkgs.systemd}/bin/systemctl restart buildbot-worker";
ExecStart = "${python.pkgs.twisted}/bin/twistd --nodaemon --pidfile= --logfile - --python ${./worker.py}";
};
};
}