diff --git a/modules/nixos/services/syncthing.nix b/modules/nixos/services/syncthing.nix index 7c94f7d..1505b3f 100644 --- a/modules/nixos/services/syncthing.nix +++ b/modules/nixos/services/syncthing.nix @@ -20,7 +20,7 @@ in type = lib.types.nonEmptyStr; default = "${self}/hosts/${netCfg.hostName}/keys/syncthing.id" |> lib.readFile |> lib.trim; }; - port = lib.mkOption { + syncPort = lib.mkOption { type = lib.types.port; default = 22000; }; @@ -120,7 +120,7 @@ in |> lib.mapAttrs ( _: host: { id = host.config.custom.services.syncthing.deviceId; - addresses = lib.singleton "tcp://${host.config.custom.networking.overlay.address}:${toString host.config.custom.services.syncthing.port}"; + addresses = lib.singleton "tcp://${host.config.custom.networking.overlay.address}:${toString host.config.custom.services.syncthing.syncPort}"; } ); @@ -135,7 +135,7 @@ in }); options = { - listenAddress = "tcp://${netCfg.overlay.address}:${toString cfg.port}"; + listenAddress = "tcp://${netCfg.overlay.address}:${toString cfg.syncPort}"; globalAnnounceEnabled = false; localAnnounceEnabled = false; relaysEnabled = false; @@ -149,7 +149,7 @@ in }; nebula.networks.mesh.firewall.inbound = lib.singleton { - inherit (cfg) port; + port = cfg.syncPort; proto = "tcp"; group = "syncthing"; }; diff --git a/modules/nixos/web-services/glance.nix b/modules/nixos/web-services/glance.nix index 6442030..0cd3a12 100644 --- a/modules/nixos/web-services/glance.nix +++ b/modules/nixos/web-services/glance.nix @@ -8,6 +8,9 @@ let cfg = config.custom.web-services.glance; + perHostDomains = + perHostSitesWidget.widgets |> lib.concatMap (widget: widget.sites) |> lib.map (site: site.domain); + perHostSitesWidget = allHosts |> lib.attrValues @@ -18,8 +21,7 @@ let sites = host.config.custom.meta.sites |> lib.attrValues - |> lib.filter (site: site.domain |> lib.hasSuffix host.config.custom.networking.overlay.fqdn) - |> lib.map (site: site // { timeout = "5s"; }); + |> lib.filter (site: site.domain |> lib.hasSuffix host.config.custom.networking.overlay.fqdn); }) |> lib.filter ({ sites, ... }: sites != [ ]) |> (widgets: { @@ -28,24 +30,21 @@ let inherit widgets; }); - perHostDomains = - perHostSitesWidget.widgets |> lib.concatMap (widget: widget.sites) |> lib.map (site: site.domain); - applicationSitesWidget = allHosts |> lib.attrValues |> lib.concatMap (host: host.config.custom.meta.sites |> lib.attrValues) - |> lib.filter (site: !lib.elem site.domain perHostDomains) + |> lib.filter (service: !lib.elem service.domain perHostDomains) |> lib.groupBy ( - site: - site.domain |> self.lib.isPrivateDomain |> (isPrivate: if isPrivate then "Private" else "Public") + service: + service.domain |> self.lib.isPrivateDomain |> (isPrivate: if isPrivate then "Private" else "Public") ) |> lib.mapAttrsToList ( name: value: { type = "monitor"; cache = "1m"; title = "${name} Services"; - sites = value |> lib.map (site: site // { timeout = "5s"; }); + sites = value; } ) |> (widgets: { diff --git a/tests/syncthing/default.nix b/tests/syncthing/default.nix index 5a12767..f93224d 100644 --- a/tests/syncthing/default.nix +++ b/tests/syncthing/default.nix @@ -65,7 +65,7 @@ client1NetCfg = nodes.client1.custom.networking.overlay; client2NetCfg = nodes.client2.custom.networking.overlay; - getSyncPort = hostName: nodes.${hostName}.custom.services.syncthing.port |> toString; + getSyncPort = hostName: nodes.${hostName}.custom.services.syncthing.syncPort |> toString; in '' start_all()