{ lib, config, pkgs, ... }: let cfg = config.my.servers.gitea; setup = import ./setup.nix { inherit lib config; }; in { imports = [ ./gitea-actions-runners/ryujinx.nix ./gitea-actions-runners/nixos.nix ]; options.my.servers.gitea = setup.mkOptions "gitea" "git" 9083; config = lib.mkIf (cfg.enable && config.my.secureHost) { sops.secrets.gitea.sopsFile = ../../secrets/env.yaml; services.gitea = { enable = true; domain = cfg.host; rootUrl = cfg.url; settings = { session.COOKIE_SECURE = true; server.HTTP_PORT = cfg.port; mailer = { ENABLED = true; PROTOCOL = "sendmail"; FROM = config.my.smtpemail; SENDMAIL_PATH = "${pkgs.msmtp}/bin/msmtp"; }; }; database = { socket = config.my.postgresSocket; type = "postgres"; createDatabase = false; }; }; }; }