mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 18:03:04 +00:00
networkd: add DHCPServer config section
This commit is contained in:
parent
2307d24544
commit
83a64cecc9
@ -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;
|
||||
@ -567,6 +589,11 @@ let
|
||||
[DHCP]
|
||||
${attrsToSection def.dhcpConfig}
|
||||
|
||||
''}
|
||||
${optionalString (def.dhcpServerConfig != { }) ''
|
||||
[DHCPServer]
|
||||
${attrsToSection def.dhcpServerConfig}
|
||||
|
||||
''}
|
||||
${flip concatMapStrings def.addresses (x: ''
|
||||
[Address]
|
||||
|
Loading…
Reference in New Issue
Block a user