forked from raito/shared-public-infra
60 lines
1.8 KiB
Nix
60 lines
1.8 KiB
Nix
{ lib, pkgs, config, inputs, ... }:
|
|
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
|
|
|
|
nix.settings.allowed-users = [ "buildbot-worker" ];
|
|
nix.settings.trusted-users = [ "buildbot-worker" ];
|
|
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 = [
|
|
pkgs.nix-eval-jobs
|
|
pkgs.git
|
|
pkgs.gh
|
|
pkgs.nix
|
|
pkgs.nix-output-monitor
|
|
inputs.attic.packages.x86_64-linux.attic
|
|
];
|
|
environment.PYTHONPATH = "${python.withPackages (_: [package])}/${python.sitePackages}";
|
|
environment.MASTER_URL = ''TCP:2a01\\:e34\\:ec2a\\:8e60\\:8ec7\\:b5d2\\:f663\\:a67a:9989'';
|
|
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}";
|
|
};
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|