{ lib, config, ... }: let cfg = config.modules.services.owncast; fqdn = "${cfg.subdomain}.${config.networking.domain}"; in { options.modules.services.owncast = { enable = lib.mkEnableOption "Enable Owncast"; subdomain = lib.mkOption { type = lib.types.str; }; port = lib.mkOption { type = lib.types.int; default = 8080; }; }; config = lib.mkIf cfg.enable { services.owncast = { enable = true; openFirewall = true; inherit (cfg) port; }; modules.services.webserver.vHosts.${fqdn}.locations."/".proxyPort = cfg.port; }; }