From 16422d280959808aff1670a066788e98049f42b7 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 5 Apr 2023 14:04:11 +0200 Subject: [PATCH] introduce back static ipv4 prefix lenght but with default value --- cluster/staging/node/df-pw5.nix | 2 +- cluster/staging/node/origan.nix | 2 +- cluster/staging/node/piranha.nix | 2 +- nix/deuxfleurs.nix | 7 ++++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cluster/staging/node/df-pw5.nix b/cluster/staging/node/df-pw5.nix index e1a132c..2f20f1c 100644 --- a/cluster/staging/node/df-pw5.nix +++ b/cluster/staging/node/df-pw5.nix @@ -10,7 +10,7 @@ boot.loader.timeout = 20; deuxfleurs.hostName = "df-pw5"; - deuxfleurs.staticIPv4.address = "192.168.5.130/24"; + deuxfleurs.staticIPv4.address = "192.168.5.130"; deuxfleurs.staticIPv6.address = "2a02:a03f:6510:5102:223:24ff:feb0:e8a7"; system.stateVersion = "22.11"; diff --git a/cluster/staging/node/origan.nix b/cluster/staging/node/origan.nix index 6906f4d..49ecbbf 100644 --- a/cluster/staging/node/origan.nix +++ b/cluster/staging/node/origan.nix @@ -9,7 +9,7 @@ boot.loader.efi.canTouchEfiVariables = true; deuxfleurs.hostName = "origan"; - deuxfleurs.staticIPv4.address = "192.168.1.33/24"; + deuxfleurs.staticIPv4.address = "192.168.1.33"; deuxfleurs.staticIPv6.address = "2a01:e0a:5e4:1d0:223:24ff:feaf:fdec"; deuxfleurs.isRaftServer = true; diff --git a/cluster/staging/node/piranha.nix b/cluster/staging/node/piranha.nix index bc1aa03..896f169 100644 --- a/cluster/staging/node/piranha.nix +++ b/cluster/staging/node/piranha.nix @@ -9,7 +9,7 @@ boot.loader.efi.canTouchEfiVariables = true; deuxfleurs.hostName = "piranha"; - deuxfleurs.staticIPv4.address = "192.168.1.25/24"; + deuxfleurs.staticIPv4.address = "192.168.1.25"; deuxfleurs.staticIPv6.address = "2a01:cb05:9142:7400:223:24ff:feb0:ea82"; deuxfleurs.isRaftServer = true; diff --git a/nix/deuxfleurs.nix b/nix/deuxfleurs.nix index 57486c2..74a5734 100644 --- a/nix/deuxfleurs.nix +++ b/nix/deuxfleurs.nix @@ -37,6 +37,11 @@ in type = nullOr str; default = null; }; + staticIPv4.prefixLength = mkOption { + description = "IPv4 prefix length for LAN addresses, only used with static configuration"; + type = int; + default = 24; + }; staticIPv6.defaultGateway = mkOption { description = '' IPv6 address of the default route on the local network interface. @@ -161,7 +166,7 @@ in matchConfig.Name = "en* eth*"; address = - optional noDHCP "${cfg.staticIPv4.address}" + optional noDHCP "${cfg.staticIPv4.address}/${toString cfg.staticIPv4.prefixLength}" ++ optional noRA "${cfg.staticIPv6.address}/${toString cfg.staticIPv6.prefixLength}"; routes =