diff --git a/config/cluster.nix b/config/cluster.nix index b6aa9d0..bb43be4 100644 --- a/config/cluster.nix +++ b/config/cluster.nix @@ -114,7 +114,6 @@ server27 = "2a00:8180:2c00:284::127"; server28 = "2a00:8180:2c00:284::128"; server29 = "2a00:8180:2c00:284::129"; - server30 = "2a00:8180:2c00:284::130"; }; }; subnet4 = "172.20.77.0/27"; diff --git a/config/priv.nix b/config/priv.nix index 3557748..19ead56 100644 --- a/config/priv.nix +++ b/config/priv.nix @@ -730,7 +730,7 @@ hosts4 = { priv39-gw = "172.20.77.129"; }; hosts6 = { dn42 = { priv39-gw = "fd23:42:c3d2:5e6::1"; }; - up4 = { priv39-gw = "2a00:8180:2c00:2e5::1"; }; + up4 = { priv39-gw = "2a00:8180:2c00:2e6::1"; }; }; subnet4 = "172.20.77.128/28"; subnets6 = { @@ -774,7 +774,7 @@ hosts4 = { priv40-gw = "172.20.77.65"; }; hosts6 = { dn42 = { priv40-gw = "fd23:42:c3d2:5e7::1"; }; - up4 = { priv40-gw = "2a00:8180:2c00:2e6::1"; }; + up4 = { priv40-gw = "2a00:8180:2c00:2e7::1"; }; }; subnet4 = "172.20.77.64/28"; subnets6 = { @@ -796,7 +796,7 @@ hosts4 = { priv41-gw = "172.20.77.193"; }; hosts6 = { dn42 = { priv41-gw = "fd23:42:c3d2:5e8::1"; }; - up4 = { priv41-gw = "2a00:8180:2c00:2e7::1"; }; + up4 = { priv41-gw = "2a00:8180:2c00:2e8::1"; }; }; subnet4 = "172.20.77.192/28"; subnets6 = { @@ -818,7 +818,7 @@ hosts4 = { priv42-gw = "172.20.76.33"; }; hosts6 = { dn42 = { priv42-gw = "fd23:42:c3d2:5e9::1"; }; - up4 = { priv42-gw = "2a00:8180:2c00:2e8::1"; }; + up4 = { priv42-gw = "2a00:8180:2c00:2e9::1"; }; }; subnet4 = "172.20.76.32/28"; subnets6 = { diff --git a/config/serv.nix b/config/serv.nix index 0319d06..c5ca366 100644 --- a/config/serv.nix +++ b/config/serv.nix @@ -9,7 +9,6 @@ stats = "172.20.73.3"; radius = "172.20.73.4"; zeit = "172.20.73.5"; - ntp = "172.20.73.5"; minecraft = "172.20.73.6"; used1 = "172.20.73.7"; dnscache = "172.20.73.8"; @@ -37,7 +36,6 @@ used16 = "172.20.73.30"; used17 = "172.20.73.31"; scrape = "172.20.73.32"; - used18 = "172.20.73.32"; used19 = "172.20.73.33"; used20 = "172.20.73.34"; used21 = "172.20.73.35"; diff --git a/nix/lib/config/options.nix b/nix/lib/config/options.nix index 7503c49..8387ec3 100644 --- a/nix/lib/config/options.nix +++ b/nix/lib/config/options.nix @@ -556,8 +556,49 @@ in (reportCollisions "IPv6 subnet" (x: builtins.attrValues x.subnets6) config.site.net) ++ ospfUpstreamXorGw; - config.assertions = map (name: { - assertion = ! config.site.net ? ${name}; - message = "Host \"${name}\" must be named differently if net \"${name}\" exists."; - }) (builtins.attrNames config.site.hosts); + config.assertions = + # Duplicate host/net name check + map (name: { + assertion = ! config.site.net ? ${name}; + message = "Host \"${name}\" must be named differently if net \"${name}\" exists."; + }) (builtins.attrNames config.site.hosts) + ++ + # Duplicate address check + (let + addrHosts = + builtins.foldl' (result: { hosts4, ... }: + builtins.foldl' (result: host: + let + addr = hosts4.${host}; + in + if result ? ${addr} + then result // { + "${addr}" = result.${addr} ++ [ host ]; + } + else result // { + "${addr}" = [ host ]; + } + ) result (builtins.attrNames hosts4) + ) {} (builtins.attrValues config.site.net) + // + builtins.foldl' (result: net: + builtins.foldl' (result: ctx: + builtins.foldl' (result: host: + let + addr = config.site.net.${net}.hosts6.${ctx}.${host}; + in + if result ? ${addr} + then result // { + "${addr}" = result.${addr} ++ [ host ]; + } + else result // { + "${addr}" = [ host ]; + } + ) result (builtins.attrNames config.site.net.${net}.hosts6.${ctx}) + ) result (builtins.attrNames config.site.net.${net}.hosts6) + ) {} (builtins.attrNames config.site.net); + in map (addr: { + assertion = builtins.length addrHosts.${addr} == 1; + message = "Address ${addr} is assigned to more than one host: ${lib.concatStringsSep " " addrHosts.${addr}}"; + }) (builtins.attrNames addrHosts)); }