{ pkgs, lib, config, ... }: let cfg = config.mods.server.sync; in { options.mods.server.sync = { enable = lib.mkEnableOption { default = false; description = "enables synchronisation related servers"; }; address = lib.mkOption { default = "127.0.0.1"; }; port = lib.mkOption { default = "8384"; }; }; config = lib.mkIf cfg.enable { services.syncthing.enable = true; networking.firewall.allowedTCPPorts = [ 8384 22000 ]; networking.firewall.allowedUDPPorts = [ 22000 21027 ]; services.syncthing.guiAddress = "${cfg.address}:${cfg.port}"; }; }