mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-20 01:16:57 +01:00
Merge pull request #166189 from jmbaur/dhcpd6-reserved-addresses
nixos/dhcpd6: Use fixed-address6 for dhcpd6 address reservations
This commit is contained in:
commit
18071b3d1a
1 changed files with 5 additions and 3 deletions
|
@ -7,7 +7,7 @@ let
|
|||
cfg4 = config.services.dhcpd4;
|
||||
cfg6 = config.services.dhcpd6;
|
||||
|
||||
writeConfig = cfg: pkgs.writeText "dhcpd.conf"
|
||||
writeConfig = postfix: cfg: pkgs.writeText "dhcpd.conf"
|
||||
''
|
||||
default-lease-time 600;
|
||||
max-lease-time 7200;
|
||||
|
@ -21,7 +21,9 @@ let
|
|||
(machine: ''
|
||||
host ${machine.hostName} {
|
||||
hardware ethernet ${machine.ethernetAddress};
|
||||
fixed-address ${machine.ipAddress};
|
||||
fixed-address${
|
||||
optionalString (postfix == "6") postfix
|
||||
} ${machine.ipAddress};
|
||||
}
|
||||
'')
|
||||
cfg.machines
|
||||
|
@ -33,7 +35,7 @@ let
|
|||
configFile =
|
||||
if cfg.configFile != null
|
||||
then cfg.configFile
|
||||
else writeConfig cfg;
|
||||
else writeConfig postfix cfg;
|
||||
leaseFile = "/var/lib/dhcpd${postfix}/dhcpd.leases";
|
||||
args = [
|
||||
"@${pkgs.dhcp}/sbin/dhcpd" "dhcpd${postfix}" "-${postfix}"
|
||||
|
|
Loading…
Reference in a new issue