system/nixos/hosts/magenta/services/woodpecker/agent-docker.nix

36 lines
1.1 KiB
Nix

{ pkgs, config, ... }:
let
canigouData = import ../../data.secret.nix;
data = import ./data.secret.nix;
inherit (data) userAgent group grpcPort;
dockerSockVolume = "/var/run/docker.sock:/var/run/docker.sock";
dockerConfVolume = "${config.age.secrets.woodpecker-docker-config.path}:/root/.docker/config.json";
in
{
systemd.services.woodpecker-agent = {
enable = true;
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
restartIfChanged = true;
serviceConfig = {
EnvironmentFile = [
config.age.secrets.woodpecker-common-env.path
];
Environment = [
"WOODPECKER_DEBUG_PRETTY=true"
"WOODPECKER_LOG_LEVEL=trace"
"WOODPECKER_SERVER=${canigouData.addr}:${toString grpcPort}"
"WOODPECKER_MAX_WORKFLOWS=2"
"WOODPECKER_BACKEND=docker"
"WOODPECKER_BACKEND_DOCKER_VOLUMES=${dockerSockVolume},${dockerConfVolume}"
];
ExecStart = "${pkgs.unstable.woodpecker-agent}/bin/woodpecker-agent";
User = userAgent;
Group = group;
};
};
}