diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 01:35:06 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 02:11:48 +0200 |
commit | 1a64deeb894dc95e2645a75771732c6cc53a79ad (patch) | |
tree | 1b9df4838f894577a09b9b260151756272efeb53 /systems/dilion/vms/buildbot_configuration.nix | |
parent | fa25ffd4583cc362075cd5e1b4130f33306103f0 (diff) | |
download | Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.gz Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.zst Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.zip |
Squash changes containing private information
There were a lot of changes since the previous commit, but a lot of them
contained personnal information about users. All thos changes got
stashed into a single commit (history is kept in a different place) and
private information was moved in a separate private repository
Diffstat (limited to 'systems/dilion/vms/buildbot_configuration.nix')
-rw-r--r-- | systems/dilion/vms/buildbot_configuration.nix | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/systems/dilion/vms/buildbot_configuration.nix b/systems/dilion/vms/buildbot_configuration.nix new file mode 100644 index 0000000..622f8ba --- /dev/null +++ b/systems/dilion/vms/buildbot_configuration.nix | |||
@@ -0,0 +1,73 @@ | |||
1 | { pkgs, config, lib, ... }: | ||
2 | { | ||
3 | imports = [ | ||
4 | ./base_configuration.nix | ||
5 | ]; | ||
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? | ||
12 | |||
13 | systemd.services.buildbot-worker.serviceConfig.ExecStartPre = let | ||
14 | cfg = config.services.buildbot-worker; | ||
15 | script = pkgs.writeScript "decode-dmi" '' | ||
16 | #!${pkgs.stdenv.shell} | ||
17 | |||
18 | mkdir -vp "${cfg.buildbotDir}" | ||
19 | varfile=${cfg.buildbotDir}/variables | ||
20 | rm $varfile || true | ||
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 | ||
25 | done | ||
26 | chown -R ${cfg.user}:${cfg.group} ${cfg.buildbotDir} | ||
27 | ''; | ||
28 | in | ||
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" '' | ||
33 | import os | ||
34 | from io import open | ||
35 | |||
36 | from buildbot_worker.bot import Worker | ||
37 | from twisted.application import service | ||
38 | |||
39 | basedir = '${cfg.buildbotDir}' | ||
40 | |||
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') | ||
44 | |||
45 | import configparser | ||
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"] | ||
52 | |||
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} | ||
56 | umask = None | ||
57 | maxdelay = 300 | ||
58 | numcpus = None | ||
59 | allow_shutdown = None | ||
60 | |||
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) | ||
65 | ''; | ||
66 | in | ||
67 | lib.mkForce "${cfg.package.pythonModule.pkgs.twisted}/bin/twistd --nodaemon --pidfile= --logfile - --python ${tacFile}"; | ||
68 | services.buildbot-worker = { | ||
69 | enable = true; | ||
70 | workerPass = config.myEnv.buildbot.workerPassword; | ||
71 | packages = [ pkgs.git pkgs.gzip pkgs.openssh ]; | ||
72 | }; | ||
73 | } | ||