Compare commits

...

3 commits

3 changed files with 14 additions and 13 deletions

View file

@ -20,7 +20,7 @@ in
type = lib.types.nonEmptyStr;
default = "${self}/hosts/${netCfg.hostName}/keys/syncthing.id" |> lib.readFile |> lib.trim;
};
syncPort = lib.mkOption {
port = 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.syncPort}";
addresses = lib.singleton "tcp://${host.config.custom.networking.overlay.address}:${toString host.config.custom.services.syncthing.port}";
}
);
@ -135,7 +135,7 @@ in
});
options = {
listenAddress = "tcp://${netCfg.overlay.address}:${toString cfg.syncPort}";
listenAddress = "tcp://${netCfg.overlay.address}:${toString cfg.port}";
globalAnnounceEnabled = false;
localAnnounceEnabled = false;
relaysEnabled = false;
@ -149,7 +149,7 @@ in
};
nebula.networks.mesh.firewall.inbound = lib.singleton {
port = cfg.syncPort;
inherit (cfg) port;
proto = "tcp";
group = "syncthing";
};

View file

@ -8,9 +8,6 @@
let
cfg = config.custom.web-services.glance;
perHostDomains =
perHostSitesWidget.widgets |> lib.concatMap (widget: widget.sites) |> lib.map (site: site.domain);
perHostSitesWidget =
allHosts
|> lib.attrValues
@ -21,7 +18,8 @@ let
sites =
host.config.custom.meta.sites
|> lib.attrValues
|> lib.filter (site: site.domain |> lib.hasSuffix host.config.custom.networking.overlay.fqdn);
|> lib.filter (site: site.domain |> lib.hasSuffix host.config.custom.networking.overlay.fqdn)
|> lib.map (site: site // { timeout = "5s"; });
})
|> lib.filter ({ sites, ... }: sites != [ ])
|> (widgets: {
@ -30,21 +28,24 @@ 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 (service: !lib.elem service.domain perHostDomains)
|> lib.filter (site: !lib.elem site.domain perHostDomains)
|> lib.groupBy (
service:
service.domain |> self.lib.isPrivateDomain |> (isPrivate: if isPrivate then "Private" else "Public")
site:
site.domain |> self.lib.isPrivateDomain |> (isPrivate: if isPrivate then "Private" else "Public")
)
|> lib.mapAttrsToList (
name: value: {
type = "monitor";
cache = "1m";
title = "${name} Services";
sites = value;
sites = value |> lib.map (site: site // { timeout = "5s"; });
}
)
|> (widgets: {

View file

@ -65,7 +65,7 @@
client1NetCfg = nodes.client1.custom.networking.overlay;
client2NetCfg = nodes.client2.custom.networking.overlay;
getSyncPort = hostName: nodes.${hostName}.custom.services.syncthing.syncPort |> toString;
getSyncPort = hostName: nodes.${hostName}.custom.services.syncthing.port |> toString;
in
''
start_all()