2022-11-08 13:46:08 +00:00
|
|
|
{ config, pkgs, inputs, lib, ... }:
|
|
|
|
let
|
|
|
|
httpPort = 8000;
|
2022-11-08 16:13:33 +00:00
|
|
|
agentPort = 9000;
|
2022-11-08 13:46:08 +00:00
|
|
|
domain = "ci.cyplo.dev";
|
|
|
|
path = "/var/lib/woodpecker";
|
2022-11-08 19:19:25 +00:00
|
|
|
serverContainerName = "woodpecker-server";
|
|
|
|
|
2022-11-08 16:13:33 +00:00
|
|
|
in {
|
2022-11-08 13:46:08 +00:00
|
|
|
imports = [ ../nginx.nix ];
|
|
|
|
|
|
|
|
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-11-08 19:19:25 +00:00
|
|
|
virtualisation.oci-containers.containers."${serverContainerName}" = {
|
2022-11-08 13:46:08 +00:00
|
|
|
image =
|
2022-11-08 19:25:33 +00:00
|
|
|
"woodpeckerci/woodpecker-server@sha256:e6027e46a782d50790183b7274a2a2ad3a6c6fb9a645e6af81a16419613c28ea";
|
2022-11-08 13:46:08 +00:00
|
|
|
volumes = [ "woodpecker-server-data:${path}" ];
|
|
|
|
environmentFiles = [ "${config.sops.secrets.gitea-env.path}" ];
|
|
|
|
environment = {
|
2022-11-08 19:19:25 +00:00
|
|
|
WOODPECKER_OPEN = "false";
|
|
|
|
WOODPECKER_ADMIN = "cyplo";
|
2022-11-08 13:46:08 +00:00
|
|
|
WOODPECKER_HOST = "https://${domain}";
|
|
|
|
WOODPECKER_GITEA = "true";
|
|
|
|
WOODPECKER_GITEA_URL = "https://git.cyplo.dev";
|
|
|
|
};
|
|
|
|
ports = [ "${toString httpPort}:${toString httpPort}" ];
|
|
|
|
};
|
2022-11-08 16:13:33 +00:00
|
|
|
|
2022-11-08 19:25:33 +00:00
|
|
|
virtualisation.oci-containers.containers.woodpecker-agent = {
|
|
|
|
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}" ];
|
|
|
|
environment = {
|
|
|
|
WOODPECKER_SERVER = "woodpecker-server:${toString agentPort}";
|
|
|
|
WOODPECKER_MAX_PROCS = "2";
|
|
|
|
};
|
|
|
|
};
|
2022-11-08 13:46:08 +00:00
|
|
|
}
|