cluster/services/wireguard: use hostLinks
This commit is contained in:
parent
72636cfffb
commit
694bd7d712
2 changed files with 9 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ config, depot, ... }:
|
{ config, depot, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (depot.config) hours;
|
inherit (depot.config) hours;
|
||||||
|
@ -13,16 +13,11 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
vars = {
|
vars = {
|
||||||
mesh = {
|
mesh = lib.genAttrs config.services.wireguard.nodes.mesh (node: config.hostLinks.${node}.mesh.extra);
|
||||||
checkmate = config.links.mesh-node-checkmate.extra;
|
|
||||||
thunderskin = config.links.mesh-node-thunderskin.extra;
|
|
||||||
VEGAS = config.links.mesh-node-VEGAS.extra;
|
|
||||||
prophet = config.links.mesh-node-prophet.extra;
|
|
||||||
};
|
|
||||||
inherit meshNet;
|
inherit meshNet;
|
||||||
};
|
};
|
||||||
links = {
|
hostLinks = {
|
||||||
mesh-node-checkmate = {
|
checkmate.mesh = {
|
||||||
ipv4 = getExtAddr hours.checkmate;
|
ipv4 = getExtAddr hours.checkmate;
|
||||||
extra = {
|
extra = {
|
||||||
meshIp = "10.1.1.32";
|
meshIp = "10.1.1.32";
|
||||||
|
@ -32,7 +27,7 @@ in
|
||||||
extraRoutes = [];
|
extraRoutes = [];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
mesh-node-thunderskin = {
|
thunderskin.mesh = {
|
||||||
ipv4 = getExtAddr hours.thunderskin;
|
ipv4 = getExtAddr hours.thunderskin;
|
||||||
extra = {
|
extra = {
|
||||||
meshIp = "10.1.1.4";
|
meshIp = "10.1.1.4";
|
||||||
|
@ -42,7 +37,7 @@ in
|
||||||
extraRoutes = [];
|
extraRoutes = [];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
mesh-node-VEGAS = {
|
VEGAS.mesh = {
|
||||||
ipv4 = getExtAddr hours.VEGAS;
|
ipv4 = getExtAddr hours.VEGAS;
|
||||||
extra = {
|
extra = {
|
||||||
meshIp = "10.1.1.5";
|
meshIp = "10.1.1.5";
|
||||||
|
@ -52,7 +47,7 @@ in
|
||||||
extraRoutes = [ "${hours.VEGAS.interfaces.vstub.addr}/32" "10.10.0.0/16" ];
|
extraRoutes = [ "${hours.VEGAS.interfaces.vstub.addr}/32" "10.10.0.0/16" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
mesh-node-prophet = {
|
prophet.mesh = {
|
||||||
ipv4 = getExtAddr hours.prophet;
|
ipv4 = getExtAddr hours.prophet;
|
||||||
extra = {
|
extra = {
|
||||||
meshIp = "10.1.1.9";
|
meshIp = "10.1.1.9";
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
let
|
let
|
||||||
inherit (config.networking) hostName;
|
inherit (config.networking) hostName;
|
||||||
|
|
||||||
link = cluster.config.links."mesh-node-${hostName}";
|
link = cluster.config.hostLinks.${hostName}.mesh;
|
||||||
|
|
||||||
mkPeer = peerName: let
|
mkPeer = peerName: let
|
||||||
peerLink = cluster.config.links."mesh-node-${peerName}";
|
peerLink = cluster.config.hostLinks.${peerName}.mesh;
|
||||||
in {
|
in {
|
||||||
publicKey = peerLink.extra.pubKey;
|
publicKey = peerLink.extra.pubKey;
|
||||||
allowedIPs = [ "${peerLink.extra.meshIp}/32" ] ++ peerLink.extra.extraRoutes;
|
allowedIPs = [ "${peerLink.extra.meshIp}/32" ] ++ peerLink.extra.extraRoutes;
|
||||||
|
|
Loading…
Reference in a new issue