dotfiles/nixos/boxes/vpsfree1/woodpecker.nix

59 lines
1.8 KiB
Nix
Raw Normal View History

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";
2022-12-02 21:34:38 +00:00
path = "/var/lib/woodpecker";
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;
virtualisation.oci-containers.containers."${serverContainerName}" = {
2022-11-08 13:46:08 +00:00
image =
"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 = {
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}" ];
extraOptions = [ "--network=woodpecker" ];
2022-11-08 13:46:08 +00:00
};
2022-11-08 16:13: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 = "${serverContainerName}:${toString agentPort}";
WOODPECKER_MAX_PROCS = "2";
};
extraOptions = [ "--network=woodpecker" ];
};
2022-11-08 13:46:08 +00:00
}