2023-08-01 16:57:22 +02:00
|
|
|
{ config, lib, ... }:
|
2023-03-18 12:51:12 +01:00
|
|
|
let
|
|
|
|
cfg = config.my.services.woodpecker;
|
|
|
|
|
|
|
|
hasRunner = (name: builtins.elem name cfg.runners);
|
|
|
|
in
|
|
|
|
{
|
|
|
|
config = lib.mkIf (cfg.enable && hasRunner "docker") {
|
|
|
|
services.woodpecker-agents = {
|
|
|
|
agents.docker = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
WOODPECKER_SERVER = "localhost:${toString cfg.rpcPort}";
|
|
|
|
WOODPECKER_MAX_WORKFLOWS = "10";
|
|
|
|
WOODPECKER_BACKEND = "docker";
|
|
|
|
WOODPECKER_FILTER_LABELS = "type=docker";
|
|
|
|
WOODPECKER_HEALTHCHECK = "false";
|
|
|
|
};
|
|
|
|
|
|
|
|
environmentFile = [ cfg.sharedSecretFile ];
|
|
|
|
|
|
|
|
extraGroups = [ "docker" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Make sure it is activated in that case
|
2023-06-11 17:25:19 +02:00
|
|
|
my.system.docker.enable = true;
|
2023-03-18 12:51:12 +01:00
|
|
|
|
|
|
|
# Adjust runner service for nix usage
|
|
|
|
systemd.services.woodpecker-agent-docker = {
|
|
|
|
after = [ "docker.socket" ]; # Needs the socket to be available
|
|
|
|
# might break deployment
|
|
|
|
restartIfChanged = false;
|
|
|
|
serviceConfig = {
|
|
|
|
BindPaths = [
|
|
|
|
"/var/run/docker.sock"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2021-11-03 14:43:16 +01:00
|
|
|
|
|
|
|
# FIXME: persistence?
|
2023-03-18 12:51:12 +01:00
|
|
|
};
|
|
|
|
}
|