1{ lib, pkgs, ... }:
2
3{
4 name = "buildkite-agent";
5 meta.maintainers = with lib.maintainers; [ flokli ];
6
7 nodes.machine =
8 { pkgs, ... }:
9 {
10 services.buildkite-agents = {
11 one = {
12 privateSshKeyPath = (import ./ssh-keys.nix pkgs).snakeOilPrivateKey;
13 tokenPath = (pkgs.writeText "my-token" "5678");
14 };
15 two = {
16 tokenPath = (pkgs.writeText "my-token" "1234");
17 };
18 };
19 };
20
21 testScript = ''
22 start_all()
23 # we can't wait on the unit to start up, as we obviously can't connect to buildkite,
24 # but we can look whether files are set up correctly
25
26 machine.wait_for_file("/var/lib/buildkite-agent-one/buildkite-agent.cfg")
27 machine.wait_for_file("/var/lib/buildkite-agent-one/.ssh/id_rsa")
28
29 machine.wait_for_file("/var/lib/buildkite-agent-two/buildkite-agent.cfg")
30 '';
31}