1 { pkgs, config, lib, ... }:
4 ./base_configuration.nix
6 # This value determines the NixOS release with which your system is
7 # to be compatible, in order to avoid breaking some software such as
8 # database servers. You should change this only after NixOS release
9 # notes say you should.
10 # https://nixos.org/nixos/manual/release-notes.html
11 system.stateVersion = "23.05"; # Did you read the comment?
13 systemd.services.buildbot-worker.serviceConfig.ExecStartPre = let
14 cfg = config.services.buildbot-worker;
15 script = pkgs.writeScript "decode-dmi" ''
16 #!${pkgs.stdenv.shell}
18 mkdir -vp "${cfg.buildbotDir}"
19 varfile=${cfg.buildbotDir}/variables
21 echo "[DEFAULT]" > $varfile
22 strings=$(${pkgs.dmidecode}/bin/dmidecode --oem-string count)
23 for i in $(seq 1 $strings); do
24 ${pkgs.dmidecode}/bin/dmidecode --oem-string $i >> $varfile
26 chown -R ${cfg.user}:${cfg.group} ${cfg.buildbotDir}
29 lib.mkForce ["+${script}"];
30 systemd.services.buildbot-worker.serviceConfig.ExecStart = let
31 cfg = config.services.buildbot-worker;
32 tacFile = pkgs.writeText "buildbot-worker.tac" ''
36 from buildbot_worker.bot import Worker
37 from twisted.application import service
39 basedir = '${cfg.buildbotDir}'
41 # note: this line is matched against to check that this is a worker
42 # directory; do not edit it.
43 application = service.Application('buildbot-worker')
46 config = config = configparser.ConfigParser()
47 config.read("${cfg.buildbotDir}/variables")
48 master_url_split = config["DEFAULT"]["buildbot_master_url"].split(':')
49 buildmaster_host = master_url_split[0]
50 port = int(master_url_split[1])
51 workername = config["DEFAULT"]["buildbot_worker_name"]
53 with open('${cfg.workerPassFile}', 'r', encoding='utf-8') as passwd_file:
54 passwd = passwd_file.read().strip('\r\n')
55 keepalive = ${toString cfg.keepalive}
61 s = Worker(buildmaster_host, port, workername, passwd, basedir,
62 keepalive, umask=umask, maxdelay=maxdelay,
63 numcpus=numcpus, allow_shutdown=allow_shutdown)
64 s.setServiceParent(application)
67 lib.mkForce "${cfg.package.pythonModule.pkgs.twisted}/bin/twistd --nodaemon --pidfile= --logfile - --python ${tacFile}";
68 services.buildbot-worker = {
70 workerPass = config.myEnv.buildbot.workerPassword;
71 packages = [ pkgs.git pkgs.gzip pkgs.openssh ];