From 21a9864cd7c35985a750f37b1659b742ad3fb2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 4 Nov 2023 12:29:35 +0100 Subject: [PATCH 1/2] create gcroots directory for buildbot --- nix/worker.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nix/worker.nix b/nix/worker.nix index a087edf..2fdf3eb 100644 --- a/nix/worker.nix +++ b/nix/worker.nix @@ -32,6 +32,12 @@ in }; config = lib.mkIf cfg.enable { nix.settings.extra-allowed-users = [ "buildbot-worker" ]; + + # Allow buildbot-worker to create gcroots + systemd.tmpfiles.rules = [ + "d /nix/var/nix/gcroots/per-user/${config.users.users.buildbot-worker.name} 0755 ${config.users.users.buildbot-worker.name} root - -" + ]; + users.users.buildbot-worker = { description = "Buildbot Worker User."; isSystemUser = true; From 19d2d512f02804e68c2c0e4461b5b9d1f33b4c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 4 Nov 2023 13:48:58 +0100 Subject: [PATCH 2/2] add integration test for worker --- nix/checks/flake-module.nix | 1 + nix/checks/worker.nix | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 nix/checks/worker.nix diff --git a/nix/checks/flake-module.nix b/nix/checks/flake-module.nix index 5a569d1..d5663aa 100644 --- a/nix/checks/flake-module.nix +++ b/nix/checks/flake-module.nix @@ -10,6 +10,7 @@ in { master = import ./master.nix checkArgs; + worker = import ./worker.nix checkArgs; }; }; } diff --git a/nix/checks/worker.nix b/nix/checks/worker.nix new file mode 100644 index 0000000..39fb20f --- /dev/null +++ b/nix/checks/worker.nix @@ -0,0 +1,21 @@ +(import ./lib.nix) { + name = "from-nixos"; + nodes = { + # `self` here is set by using specialArgs in `lib.nix` + node1 = { self, config, pkgs, ... }: { + imports = [ + self.nixosModules.buildbot-worker + ]; + services.buildbot-nix.worker = { + enable = true; + workerPasswordFile = pkgs.writeText "password" "password"; + }; + }; + }; + # This is the test code that will check if our service is running correctly: + testScript = '' + start_all() + # wait for our service to start + node1.wait_for_unit("buildbot-worker") + ''; +}