{ lib, config, ... }: let cfg = config.my.servers.gitea; setup = import ./setup.nix { inherit lib config; }; in { options.my.servers.gitea = setup.mkOptions "gitea" "git" 9083; config.services = { gitea = lib.mkIf cfg.enable { enable = true; appName = "Danilo Git"; domain = cfg.host; rootUrl = cfg.url; settings = { session.COOKIE_SECURE = true; server = { HTTP_PORT = cfg.port; START_SSH_SERVER = true; SSH_PORT = 2222; SSH_LISTEN_PORT = 2222; }; }; database = { socket = config.my.postgresSocket; type = "postgres"; createDatabase = false; }; }; nginx.virtualHosts."${cfg.host}" = lib.mkIf cfg.enableProxy (setup.proxyReverseFix cfg); }; }