2022-12-21 03:42:06 -08:00
|
|
|
{ pkgs, config, self, ... }:
|
2022-12-09 07:48:26 -08:00
|
|
|
{
|
|
|
|
users.users.woodpecker-runner = {
|
|
|
|
isSystemUser = true;
|
|
|
|
group = "woodpecker-runner";
|
2022-12-21 04:33:39 -08:00
|
|
|
home = "/var/lib/woodpecker";
|
|
|
|
createHome = true;
|
2022-12-22 22:16:19 -08:00
|
|
|
extraGroups = [ "docker" ];
|
2022-12-09 07:48:26 -08:00
|
|
|
};
|
|
|
|
users.groups.woodpecker-runner = { };
|
|
|
|
# Allow the exec runner to write to build with nix
|
2022-12-21 03:42:06 -08:00
|
|
|
nix.settings.allowed-users = [ "woodpecker-runner" ];
|
|
|
|
|
|
|
|
age.secrets.woodpecker-agent-secret.owner = "woodpecker-runner";
|
|
|
|
age.secrets.woodpecker-agent-secret.file = "${self}/secrets/woodpecker-agent-secret.age";
|
2022-12-09 07:48:26 -08:00
|
|
|
|
2022-12-22 22:16:19 -08:00
|
|
|
systemd.services.woodpecker-agent = {
|
2022-12-09 07:48:26 -08:00
|
|
|
enable = true;
|
|
|
|
### MANUALLY RESTART SERVICE IF CHANGED
|
|
|
|
restartIfChanged = true;
|
2022-12-22 22:16:19 -08:00
|
|
|
# confinement.enable = true;
|
|
|
|
# confinement.packages = [
|
|
|
|
# pkgs.git
|
|
|
|
# pkgs.gnutar
|
|
|
|
# pkgs.bash
|
|
|
|
# pkgs.nixFlakes
|
|
|
|
# pkgs.gzip
|
|
|
|
# ];
|
|
|
|
# path = [
|
|
|
|
# pkgs.git
|
|
|
|
# pkgs.gnutar
|
|
|
|
# pkgs.bash
|
|
|
|
# pkgs.nixFlakes
|
|
|
|
# pkgs.gzip
|
|
|
|
# ];
|
2022-12-09 07:48:26 -08:00
|
|
|
serviceConfig = {
|
2022-12-22 22:16:19 -08:00
|
|
|
Type = "simple";
|
2022-12-09 07:48:26 -08:00
|
|
|
Environment = [
|
2022-12-21 04:33:39 -08:00
|
|
|
"WOODPECKER_RUNNER_CAPACITY=6"
|
2022-12-22 22:16:19 -08:00
|
|
|
# "WOODPECKER_RUNNER_NAME=woodpecker-agent"
|
2022-12-21 04:33:39 -08:00
|
|
|
"WOODPECKER_SERVER=https://ci.sealight.xyz/"
|
2022-12-22 22:16:19 -08:00
|
|
|
# "WOODPECKER_HOSTNAME=mossnet"
|
|
|
|
# "WOODPECKER_BACKEND=local"
|
|
|
|
# "NIX_REMOTE=daemon"
|
|
|
|
# "PAGER=cat"
|
|
|
|
# "WOODPECKER_LOG_LEVEL=debug"
|
2022-12-09 07:48:26 -08:00
|
|
|
];
|
2022-12-22 22:16:19 -08:00
|
|
|
WorkingDirectory = "/var/lib/woodpecker";
|
|
|
|
# Runtime directory and mode
|
|
|
|
RuntimeDirectory = "woodpecker";
|
|
|
|
RuntimeDirectoryMode = "0755";
|
|
|
|
# Access write directories
|
|
|
|
ReadWritePaths = [ "/var/lib/woodpecker" ];
|
2022-12-09 07:48:26 -08:00
|
|
|
EnvironmentFile = [
|
2022-12-21 03:42:06 -08:00
|
|
|
/run/agenix/woodpecker-agent-secret
|
2022-12-09 07:48:26 -08:00
|
|
|
];
|
|
|
|
ExecStart = "${pkgs.woodpecker-agent}/bin/woodpecker-agent";
|
|
|
|
User = "woodpecker-runner";
|
|
|
|
Group = "woodpecker-runner";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|