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;
vpnIP = node: node.config.grid.monitoringvpnIPv4 or null; # "or null" since "network" in grid doesn't have a monitoringIPv4
in rec
serverIP = vpnIP grid.monitoring;
clientIPs = builtins.filter (x: x != serverIP && x != null) (map vpnIP (builtins.attrValues grid));