{ config, lib, ... }: let cfg = config.services.syncthing; fqdn = "${cfg.subdomain}.${config.networking.domain}"; in { options.services.syncthing = { subdomain = lib.mkOption { type = lib.types.str; }; port = lib.mkOption { type = lib.types.int; default = 8384; }; }; config = lib.mkIf cfg.enable { services = { syncthing = { openDefaultPorts = true; guiAddress = "[::1]:${toString cfg.port}"; settings.gui.insecureSkipHostCheck = true; }; webserver = { enable = lib.mkDefault true; vHosts.${fqdn}.locations."/".proxyPort = cfg.port; }; }; }; }