dotfiles/nixos/boxes/vpsfree1/woodpecker.nix

68 lines
1.9 KiB
Nix
Raw Normal View History

2022-12-19 09:09:08 +00:00
{
config,
pkgs,
inputs,
lib,
...
}: let
2022-11-08 13:46:08 +00:00
httpPort = 8000;
2022-11-08 16:13:33 +00:00
agentPort = 9000;
2022-11-08 13:46:08 +00:00
domain = "ci.cyplo.dev";
2022-12-02 21:34:38 +00:00
path = "/var/lib/woodpecker";
serverContainerName = "woodpecker-server";
2022-12-04 13:46:47 +00:00
agent = {
2022-12-19 09:09:08 +00:00
dependsOn = ["${serverContainerName}"];
volumes = ["/var/run/podman/podman.sock:/var/run/docker.sock"];
image = "woodpeckerci/woodpecker-agent@sha256:9a98e25ca6fcf7c437ad355cfce53a696c55b9864399a4d456429a20bfb44545";
environmentFiles = ["${config.sops.secrets.gitea-env.path}"];
2022-12-04 13:46:47 +00:00
environment = {
WOODPECKER_SERVER = "${serverContainerName}:${toString agentPort}";
WOODPECKER_MAX_PROCS = "1";
WOODPECKER_DEBUG_PRETTY = "true";
WOODPECKER_LOG_LEVEL = "info";
};
2022-12-19 09:09:08 +00:00
extraOptions = ["--network=woodpecker"];
2022-12-04 13:46:47 +00:00
};
2022-11-08 16:13:33 +00:00
in {
2022-12-19 09:09:08 +00:00
imports = [../nginx.nix];
2022-11-08 13:46:08 +00:00
services.nginx = {
virtualHosts = {
"${domain}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:" + toString httpPort;
};
};
};
};
sops.secrets."gitea-env" = {
sopsFile = ./gitea.sops;
format = "binary";
};
2022-11-08 16:13:33 +00:00
virtualisation.podman.defaultNetwork.dnsname.enable = true;
2022-12-04 13:46:47 +00:00
virtualisation.oci-containers.containers = {
"${serverContainerName}" = {
2022-12-19 09:09:08 +00:00
image = "woodpeckerci/woodpecker-server@sha256:e6027e46a782d50790183b7274a2a2ad3a6c6fb9a645e6af81a16419613c28ea";
volumes = ["woodpecker-server-data:${path}"];
environmentFiles = ["${config.sops.secrets.gitea-env.path}"];
2022-12-04 13:46:47 +00:00
environment = {
WOODPECKER_OPEN = "false";
WOODPECKER_ADMIN = "cyplo";
WOODPECKER_HOST = "https://${domain}";
WOODPECKER_GITEA = "true";
WOODPECKER_GITEA_URL = "https://git.cyplo.dev";
};
2022-12-19 09:09:08 +00:00
ports = ["${toString httpPort}:${toString httpPort}"];
extraOptions = ["--network=woodpecker"];
2022-11-08 13:46:08 +00:00
};
2022-12-04 13:46:47 +00:00
woodpecker-agent1 = agent;
woodpecker-agent2 = agent;
woodpecker-agent3 = agent;
woodpecker-agent4 = agent;
2022-11-08 13:46:08 +00:00
};
}