Newer
Older
# A function that accepts a path to a grid.nix-style file and returns a set
# with two attributes:
#
# * serverIP - a string giving the VPN IP address of the grid's VPN server.
#
# * clientIPs - a list of strings giving the VPN IP addresses of all of the
# grid's VPN clients.
#
{ pathToGrid }:
let
grid = import pathToGrid;
vpnConfig = node: node.services.private-storage.monitoring.vpn or null;
vpnClientIP = node: (vpnConfig node).client.ip or null;
vpnServerIP = node: (vpnConfig node).server.ip or null;
in
{
"serverIP" = vpnServerIP grid.monitoring;
"clientIPs" = builtins.filter (x: x != null) (map vpnClientIP (builtins.attrValues grid));
}