9c5b5600ea
In preparation for the solution of b/108, we need to consistently use `depot.third_party` for packages that are only packed in the TVL depot and `pkgs` for things that come from nixpkgs. This commit cleans up a huge chunk of these uses in //ops Change-Id: I00faeb969eaa70760a26256274925b07998c2351 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2915 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
45 lines
1.4 KiB
Nix
45 lines
1.4 KiB
Nix
# Configuration for the TVL buildkite agents.
|
|
{ config, depot, pkgs, lib, ... }:
|
|
|
|
let
|
|
cfg = config.services.depot.buildkite;
|
|
agents = lib.range 1 cfg.agentCount;
|
|
description = "Buildkite agents for TVL";
|
|
|
|
# All Buildkite hooks are actually besadii, but it's being invoked
|
|
# with different names.
|
|
buildkiteHooks = pkgs.runCommandNoCC "buildkite-hooks" {} ''
|
|
mkdir -p $out/bin
|
|
ln -s ${depot.ops.besadii}/bin/besadii $out/bin/post-command
|
|
'';
|
|
in {
|
|
options.services.depot.buildkite = {
|
|
enable = lib.mkEnableOption description;
|
|
agentCount = lib.mkOption {
|
|
type = lib.types.int;
|
|
description = "Number of Buildkite agents to launch";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# Run the Buildkite agents using the default upstream module.
|
|
services.buildkite-agents = builtins.listToAttrs (map (n: rec {
|
|
name = "whitby-${toString n}";
|
|
value = {
|
|
inherit name;
|
|
enable = true;
|
|
tokenPath = "/etc/secrets/buildkite-agent-token";
|
|
hooks.post-command = "${buildkiteHooks}/bin/post-command";
|
|
};
|
|
}) agents);
|
|
|
|
# Set up a group for all Buildkite agent users
|
|
users = {
|
|
groups.buildkite-agents = {};
|
|
users = builtins.listToAttrs (map (n: {
|
|
name = "buildkite-agent-whitby-${toString n}";
|
|
value.extraGroups = [ "buildkite-agents" ];
|
|
}) agents);
|
|
};
|
|
};
|
|
}
|