summary refs log tree commit diff
path: root/nixos/modules/system/boot/networkd.nix
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2020-01-08 20:15:09 +0100
committerAndreas Rammhold <andreas@rammhold.de>2020-05-01 13:33:54 +0200
commitbb9b61e2b7d1dd14d9685bb188d13f45cdf21ad5 (patch)
tree2e12bc5488f8a4996e68157da9ecccf36127dc8c /nixos/modules/system/boot/networkd.nix
parentfc960a012397fac681c87a20f9321b38832b2ed2 (diff)
downloadnixpkgs-bb9b61e2b7d1dd14d9685bb188d13f45cdf21ad5.tar
nixpkgs-bb9b61e2b7d1dd14d9685bb188d13f45cdf21ad5.tar.gz
nixpkgs-bb9b61e2b7d1dd14d9685bb188d13f45cdf21ad5.tar.bz2
nixpkgs-bb9b61e2b7d1dd14d9685bb188d13f45cdf21ad5.tar.lz
nixpkgs-bb9b61e2b7d1dd14d9685bb188d13f45cdf21ad5.tar.xz
nixpkgs-bb9b61e2b7d1dd14d9685bb188d13f45cdf21ad5.tar.zst
nixpkgs-bb9b61e2b7d1dd14d9685bb188d13f45cdf21ad5.zip
nixos/networkd: introduce the DHCPv6 network section eqivalent
You can now specify option for the `[DHCPv6]` section with
`systemd.network.<name>.dhcpV6Config.…`. Previously you could only use
the combined legacy DHCP configuration.
Diffstat (limited to 'nixos/modules/system/boot/networkd.nix')
-rw-r--r--nixos/modules/system/boot/networkd.nix27
1 files changed, 27 insertions, 0 deletions
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
+        <literal>[DHCPv6]</literal> section of the unit.  See
+        <citerefentry><refentrytitle>systemd.network</refentrytitle>
+        <manvolnum>5</manvolnum></citerefentry> for details.
+      '';
+    };
+
     dhcpServerConfig = mkOption {
       default = {};
       example = { PoolOffset = 50; EmitDNS = false; };
@@ -981,6 +1003,11 @@ let
             ${attrsToSection def.dhcpConfig}
 
           ''}
+          ${optionalString (def.dhcpV6Config != {}) ''
+            [DHCPv6]
+            ${attrsToSection def.dhcpV6Config}
+
+          ''}
           ${optionalString (def.dhcpServerConfig != { }) ''
             [DHCPServer]
             ${attrsToSection def.dhcpServerConfig}