diff --git a/system/hosts/router/default.nix b/system/hosts/router/default.nix index b1a1f23..9043c21 100644 --- a/system/hosts/router/default.nix +++ b/system/hosts/router/default.nix @@ -282,6 +282,7 @@ in { ]; router-settings.dhcp6Reservations = [ { ipAddress = serverAddress6; + duid = cfg.serverDuid; macAddress = cfg.serverMac; } { ipAddress = vacuumAddress6; macAddress = cfg.vacuumMac; } @@ -434,11 +435,11 @@ in { gateways = [ netAddresses.lan6 ]; radvdSettings.AdvAutonomous = true; coreradSettings.autonomous = true; - # don't autoallocate addresses, keep autonomous ones + # don't allocate addresses for most devices keaSettings.pools = [ ]; # just assign the reservations - keaSettings.reservations = map (res: { - hw-address = res.macAddress; + keaSettings.reservations = map (res: + (if res.duid != null then { duid = res.duid; } else { hw-address = res.macAddress; }) // { ip-addresses = [ res.ipAddress ]; }) cfg.dhcp6Reservations; }); diff --git a/system/hosts/router/options.nix b/system/hosts/router/options.nix index 023614b..2b6d736 100644 --- a/system/hosts/router/options.nix +++ b/system/hosts/router/options.nix @@ -13,6 +13,11 @@ description = "server's mac address"; type = lib.types.str; }; + serverDuid = lib.mkOption { + description = "server's duid"; + type = with lib.types; nullOr str; + default = null; + }; serverInitrdMac = lib.mkOption { description = "server's mac address in initrd"; type = lib.types.str; @@ -92,9 +97,15 @@ description = "device's ip address"; }; options.macAddress = lib.mkOption { - type = lib.types.str; + type = with lib.types; nullOr str; + default = null; description = "device's mac address"; }; + options.duid = lib.mkOption { + type = with lib.types; nullOr str; + default = null; + description = "device's duid"; + }; }); }; dnatRules = lib.mkOption {