omniflake/system/web-server/forgejo.nix
2026-01-14 15:22:30 +01:00

74 lines
1.7 KiB
Nix

{ lib, pkgs, config, ... }:
let
cfg = config.services.forgejo;
srv = cfg.settings.server;
in
{
security.acme.certs."${config.networking.domain}".extraDomainNames = [
"git.ktiu.net"
];
services.nginx.virtualHosts."git.ktiu.net" = {
onlySSL = true;
useACMEHost = config.networking.domain;
locations."/".proxyPass = "http://localhost:${toString srv.HTTP_PORT}";
extraConfig = ''
client_max_body_size 512M;
'';
};
services.forgejo = {
enable = true;
database.type = "postgres";
lfs.enable = true;
settings = {
server = {
# DOMAIN = "git.${config.networking.domain}";
# # You need to specify this to remove the port from URLs in the web UI.
# ROOT_URL = "https://git.ktiu.net/";
HTTP_PORT = 3080;
};
# You can temporarily allow registration to create an admin user.
service.DISABLE_REGISTRATION = true;
# Add support for actions, based on act: https://github.com/nektos/act
actions = {
ENABLED = true;
DEFAULT_ACTIONS_URL = "github";
};
# Sending emails is completely optional
# You can send a test email from the web UI at:
# Profile Picture > Site Administration > Configuration > Mailer Configuration
mailer = {
ENABLED = true;
SMTP_ADDR = "localhost";
SMTP_PORT = 25;
FROM = "Forgejo <git@${config.networking.domain}>";
};
};
# secrets = {
# mailer.PASSWD = config.age.secrets.forgejo-mailer-password.path;
# };
};
# age.secrets.forgejo-mailer-password = {
# file = ../secrets/forgejo-mailer-password.age;
# mode = "400";
# owner = "forgejo";
# };
}