From bb9b61e2b7d1dd14d9685bb188d13f45cdf21ad5 Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Wed, 8 Jan 2020 20:15:09 +0100 Subject: [PATCH] nixos/networkd: introduce the DHCPv6 network section eqivalent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit You can now specify option for the `[DHCPv6]` section with `systemd.network..dhcpV6Config.…`. Previously you could only use the combined legacy DHCP configuration. --- nixos/modules/system/boot/networkd.nix | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index d355d7ad9bd..c4790f59dff 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -301,6 +301,16 @@ let (assertValueOneOf "RapidCommit" boolValues) ]; + checkDhcpV6 = checkUnitConfig "DHCPv6" [ + (assertOnlyFields [ + "UseDns" "UseNTP" "RapidCommit" "ForceDHCPv6PDOtherInformation" + ]) + (assertValueOneOf "UseDNS" boolValues) + (assertValueOneOf "UseNTP" boolValues) + (assertValueOneOf "RapidCommit" boolValues) + (assertValueOneOf "ForceDHCPv6PDOtherInformation" boolValues) + ]; + checkDhcpServer = checkUnitConfig "DHCPServer" [ (assertOnlyFields [ "PoolOffset" "PoolSize" "DefaultLeaseTimeSec" "MaxLeaseTimeSec" @@ -651,6 +661,18 @@ let ''; }; + dhcpV6Config = mkOption { + default = {}; + example = { UseDNS = true; UseRoutes = true; }; + type = types.addCheck (types.attrsOf unitOption) checkDhcpV6; + description = '' + Each attribute in this set specifies an option in the + [DHCPv6] section of the unit. See + systemd.network + 5 for details. + ''; + }; + dhcpServerConfig = mkOption { default = {}; example = { PoolOffset = 50; EmitDNS = false; }; @@ -980,6 +1002,11 @@ let [DHCP] ${attrsToSection def.dhcpConfig} + ''} + ${optionalString (def.dhcpV6Config != {}) '' + [DHCPv6] + ${attrsToSection def.dhcpV6Config} + ''} ${optionalString (def.dhcpServerConfig != { }) '' [DHCPServer]