2024-06-13 20:12:46 +07:00
|
|
|
{ config, lib, pkgs, ... }:
|
2024-06-13 16:08:33 +07:00
|
|
|
let
|
|
|
|
cfg = config.profile.services.forgejo;
|
|
|
|
inherit (lib) mkIf;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
config = mkIf cfg.enable {
|
2024-06-13 18:59:07 +07:00
|
|
|
services.caddy.virtualHosts."git.tigor.web.id".extraConfig = ''
|
2024-06-13 20:27:06 +07:00
|
|
|
@home_not_login {
|
|
|
|
not header_regexp Cookie gitea_incredible
|
|
|
|
path /
|
|
|
|
}
|
|
|
|
redir @home_not_login /Tigor
|
2024-06-13 18:59:07 +07:00
|
|
|
reverse_proxy * unix//run/forgejo/forgejo.sock
|
|
|
|
'';
|
|
|
|
|
2024-06-13 16:08:33 +07:00
|
|
|
|
|
|
|
services.forgejo = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
2024-06-13 18:59:07 +07:00
|
|
|
server = {
|
|
|
|
PROTOCOL = "http+unix";
|
|
|
|
DOMAIN = "git.tigor.web.id";
|
|
|
|
HTTP_PORT = 443;
|
|
|
|
ROOT_URL = "https://${config.services.forgejo.settings.server.DOMAIN}:${toString config.services.forgejo.settings.server.HTTP_PORT}";
|
|
|
|
};
|
|
|
|
service = {
|
|
|
|
DISABLE_REGISTRATION = true;
|
|
|
|
};
|
2024-06-13 16:08:33 +07:00
|
|
|
session.COOKIE_SECURE = true;
|
|
|
|
};
|
|
|
|
};
|
2024-06-13 20:12:46 +07:00
|
|
|
|
|
|
|
sops.secrets."runner_token" = {
|
|
|
|
sopsFile = ../../secrets/forgejo.yaml;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.gitea-actions-runner = {
|
|
|
|
package = pkgs.forgejo-runner;
|
|
|
|
instances = {
|
|
|
|
${config.networking.hostName} = {
|
|
|
|
enable = true;
|
|
|
|
name = config.networking.hostName;
|
|
|
|
url = config.services.forgejo.settings.server.ROOT_URL;
|
|
|
|
tokenFile = config.sops.secrets."runner_token".path;
|
|
|
|
settings = {
|
|
|
|
container = {
|
|
|
|
privileged = true;
|
|
|
|
# docker_host = "unix:///var/run/docker.sock";
|
|
|
|
valid_volumes = [ "**" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
labels = [
|
|
|
|
"docker:docker://ghcr.io/catthehacker/ubuntu:act-22.04"
|
|
|
|
"native:host"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-06-13 16:08:33 +07:00
|
|
|
};
|
|
|
|
}
|