simplified comparison

This commit is contained in:
asyncnomi 2025-07-22 23:20:51 +02:00
parent 1d704ccbc8
commit 7e97e91180

View file

@ -3,7 +3,8 @@
let let
# Import nodes # Import nodes
nodes = import ./../../nodes.nix; nodes = import ./../../nodes.nix;
myPeer = nodes."${config.hostName}"; myName = config.hostName;
myPeer = nodes."${myName}";
myId = myPeer.id; myId = myPeer.id;
myZone = myPeer.zone; myZone = myPeer.zone;
@ -20,7 +21,7 @@ let
generatedSecrets = lib.mapAttrsToList (name: node: buildSecret node.zone node.id) nodes; generatedSecrets = lib.mapAttrsToList (name: node: buildSecret node.zone node.id) nodes;
# Filter itself out of the peer list # Filter itself out of the peer list
peerConfigs = lib.filterAttrs (_peerName: peerConfig: (peerConfig.zone != myZone) || (peerConfig.id != myId)) nodes; peerConfigs = lib.filterAttrs (peerName: _peerConfig: peerName != myName) nodes;
interfacePeers = lib.mapAttrsToList (peerName: peerConfig: { interfacePeers = lib.mapAttrsToList (peerName: peerConfig: {
PublicKey = peerConfig.wg-pub; PublicKey = peerConfig.wg-pub;