summary refs log tree commit diff
path: root/nixos/modules/system/boot/networkd.nix
diff options
context:
space:
mode:
authorChristian Albrecht <christian.albrecht@mayflower.de>2015-12-23 06:04:39 +0100
committerChristian Albrecht <christian.albrecht@mayflower.de>2015-12-23 06:04:39 +0100
commit83a64cecc9fbe62d187428535774b2a1293afeaf (patch)
tree43513588a850f67fe91e8b4ba0633db76be16fd1 /nixos/modules/system/boot/networkd.nix
parent2307d2454481d26e22a02456a8e988c7b1196a27 (diff)
downloadnixpkgs-83a64cecc9fbe62d187428535774b2a1293afeaf.tar
nixpkgs-83a64cecc9fbe62d187428535774b2a1293afeaf.tar.gz
nixpkgs-83a64cecc9fbe62d187428535774b2a1293afeaf.tar.bz2
nixpkgs-83a64cecc9fbe62d187428535774b2a1293afeaf.tar.lz
nixpkgs-83a64cecc9fbe62d187428535774b2a1293afeaf.tar.xz
nixpkgs-83a64cecc9fbe62d187428535774b2a1293afeaf.tar.zst
nixpkgs-83a64cecc9fbe62d187428535774b2a1293afeaf.zip
networkd: add DHCPServer config section
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 b9fb4b12e7d..ab748550026 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -131,6 +131,16 @@ let
     (assertValueOneOf "RequestBroadcast" boolValues)
   ];
 
+  checkDhcpServer = checkUnitConfig "DHCPServer" [
+    (assertOnlyFields [
+      "PoolOffset" "PoolSize" "DefaultLeaseTimeSec" "MaxLeaseTimeSec"
+      "EmitDNS" "DNS" "EmitNTP" "NTP" "EmitTimezone" "Timezone"
+    ])
+    (assertValueOneOf "EmitDNS" boolValues)
+    (assertValueOneOf "EmitNTP" boolValues)
+    (assertValueOneOf "EmitTimezone" boolValues)
+  ];
+
   commonNetworkOptions = {
 
     enable = mkOption {
@@ -343,6 +353,18 @@ let
       '';
     };
 
+    dhcpServerConfig = mkOption {
+      default = {};
+      example = { PoolOffset = 50; EmitDNS = false; };
+      type = types.addCheck (types.attrsOf unitOption) checkDhcpServer;
+      description = ''
+        Each attribute in this set specifies an option in the
+        <literal>[DHCPServer]</literal> section of the unit.  See
+        <citerefentry><refentrytitle>systemd.network</refentrytitle>
+        <manvolnum>5</manvolnum></citerefentry> for details.
+      '';
+    };
+
     name = mkOption {
       type = types.nullOr types.str;
       default = null;
@@ -568,6 +590,11 @@ let
             ${attrsToSection def.dhcpConfig}
 
           ''}
+          ${optionalString (def.dhcpServerConfig != { }) ''
+            [DHCPServer]
+            ${attrsToSection def.dhcpServerConfig}
+
+          ''}
           ${flip concatMapStrings def.addresses (x: ''
             [Address]
             ${attrsToSection x.addressConfig}