nixos-module/container/dhcp-server: fix reservations by moving them from global dhcp4 config to subnet4

This commit is contained in:
Astro 2023-10-28 03:40:15 +02:00
parent 0e2c4c7afd
commit b78f9c9305
1 changed files with 7 additions and 9 deletions

View File

@ -30,7 +30,7 @@ in
# ddns-conflict-resolution-mode = "check-exists-with-dhcid";
ddns-use-conflict-resolution = false;
subnet4 = concatMapDhcpNets (net: { vlan, subnet4, dhcp, domainName, ... }: {
subnet4 = concatMapDhcpNets (net: { vlan, subnet4, hosts4, dhcp, domainName, ... }: {
id = vlan;
subnet = subnet4;
pools = [ {
@ -56,12 +56,7 @@ in
data = "172.20.73.8, 9.9.9.9";
} ];
ddns-qualifying-suffix = domainName;
});
match-client-id = false;
host-reservation-identifiers = [ "hw-address" ];
reservations = concatMapDhcpNets (net: { hosts4, dhcp, ... }:
lib.pipe dhcp.fixed-hosts [
reservations = lib.pipe dhcp.fixed-hosts [
(builtins.mapAttrs (fixedAddr: hwaddr:
if hosts4 ? ${fixedAddr}
then # fixedAddr is a known hostname
@ -94,8 +89,11 @@ in
))
builtins.attrValues
(builtins.filter (r: r != null))
]
);
];
});
match-client-id = false;
host-reservation-identifiers = [ "hw-address" ];
# Netbooting
option-def = [ {