mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 17:49:07 +01:00
Compare commits
3 commits
c25c4341b3
...
2f11b4eec2
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f11b4eec2 | |||
| 7bf505b3b5 | |||
| ac83b330a1 |
3 changed files with 14 additions and 13 deletions
|
|
@ -20,7 +20,7 @@ in
|
||||||
type = lib.types.nonEmptyStr;
|
type = lib.types.nonEmptyStr;
|
||||||
default = "${self}/hosts/${netCfg.hostName}/keys/syncthing.id" |> lib.readFile |> lib.trim;
|
default = "${self}/hosts/${netCfg.hostName}/keys/syncthing.id" |> lib.readFile |> lib.trim;
|
||||||
};
|
};
|
||||||
syncPort = lib.mkOption {
|
port = lib.mkOption {
|
||||||
type = lib.types.port;
|
type = lib.types.port;
|
||||||
default = 22000;
|
default = 22000;
|
||||||
};
|
};
|
||||||
|
|
@ -120,7 +120,7 @@ in
|
||||||
|> lib.mapAttrs (
|
|> lib.mapAttrs (
|
||||||
_: host: {
|
_: host: {
|
||||||
id = host.config.custom.services.syncthing.deviceId;
|
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 = {
|
options = {
|
||||||
listenAddress = "tcp://${netCfg.overlay.address}:${toString cfg.syncPort}";
|
listenAddress = "tcp://${netCfg.overlay.address}:${toString cfg.port}";
|
||||||
globalAnnounceEnabled = false;
|
globalAnnounceEnabled = false;
|
||||||
localAnnounceEnabled = false;
|
localAnnounceEnabled = false;
|
||||||
relaysEnabled = false;
|
relaysEnabled = false;
|
||||||
|
|
@ -149,7 +149,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
nebula.networks.mesh.firewall.inbound = lib.singleton {
|
nebula.networks.mesh.firewall.inbound = lib.singleton {
|
||||||
port = cfg.syncPort;
|
inherit (cfg) port;
|
||||||
proto = "tcp";
|
proto = "tcp";
|
||||||
group = "syncthing";
|
group = "syncthing";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,6 @@
|
||||||
let
|
let
|
||||||
cfg = config.custom.web-services.glance;
|
cfg = config.custom.web-services.glance;
|
||||||
|
|
||||||
perHostDomains =
|
|
||||||
perHostSitesWidget.widgets |> lib.concatMap (widget: widget.sites) |> lib.map (site: site.domain);
|
|
||||||
|
|
||||||
perHostSitesWidget =
|
perHostSitesWidget =
|
||||||
allHosts
|
allHosts
|
||||||
|> lib.attrValues
|
|> lib.attrValues
|
||||||
|
|
@ -21,7 +18,8 @@ let
|
||||||
sites =
|
sites =
|
||||||
host.config.custom.meta.sites
|
host.config.custom.meta.sites
|
||||||
|> lib.attrValues
|
|> 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 != [ ])
|
|> lib.filter ({ sites, ... }: sites != [ ])
|
||||||
|> (widgets: {
|
|> (widgets: {
|
||||||
|
|
@ -30,21 +28,24 @@ let
|
||||||
inherit widgets;
|
inherit widgets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
perHostDomains =
|
||||||
|
perHostSitesWidget.widgets |> lib.concatMap (widget: widget.sites) |> lib.map (site: site.domain);
|
||||||
|
|
||||||
applicationSitesWidget =
|
applicationSitesWidget =
|
||||||
allHosts
|
allHosts
|
||||||
|> lib.attrValues
|
|> lib.attrValues
|
||||||
|> lib.concatMap (host: host.config.custom.meta.sites |> 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 (
|
|> lib.groupBy (
|
||||||
service:
|
site:
|
||||||
service.domain |> self.lib.isPrivateDomain |> (isPrivate: if isPrivate then "Private" else "Public")
|
site.domain |> self.lib.isPrivateDomain |> (isPrivate: if isPrivate then "Private" else "Public")
|
||||||
)
|
)
|
||||||
|> lib.mapAttrsToList (
|
|> lib.mapAttrsToList (
|
||||||
name: value: {
|
name: value: {
|
||||||
type = "monitor";
|
type = "monitor";
|
||||||
cache = "1m";
|
cache = "1m";
|
||||||
title = "${name} Services";
|
title = "${name} Services";
|
||||||
sites = value;
|
sites = value |> lib.map (site: site // { timeout = "5s"; });
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|> (widgets: {
|
|> (widgets: {
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
client1NetCfg = nodes.client1.custom.networking.overlay;
|
client1NetCfg = nodes.client1.custom.networking.overlay;
|
||||||
client2NetCfg = nodes.client2.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
|
in
|
||||||
''
|
''
|
||||||
start_all()
|
start_all()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue