summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2020-03-07 14:44:46 +0100
committerAndreas Rammhold <andreas@rammhold.de>2020-05-01 13:33:54 +0200
commit5abd9a74fc493c2e8be869bfb28a2f5d60ae0d6b (patch)
tree29443106ed6b7876ec447a4e5ed8e2948ac159e4
parentnixos/networkd: rename the networkd dhcpConfig option to dhcpV4Config (diff)
downloadnixpkgs-5abd9a74fc493c2e8be869bfb28a2f5d60ae0d6b.tar.gz
nixos/networkd: add ipv6PrefixDelegationConfig to networkd
-rw-r--r--nixos/modules/system/boot/networkd.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index 887d1de95ff3..ea86762db121 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -310,6 +310,20 @@ let
(assertValueOneOf "ForceDHCPv6PDOtherInformation" boolValues)
];
+ checkIpv6PrefixDelegation = checkUnitConfig "IPv6PrefixDelegation" [
+ (assertOnlyFields [
+ "Managed" "OtherInformation" "RouterLifetimeSec"
+ "RouterPreference" "EmitDNS" "DNS" "EmitDomains" "Domains"
+ "DNSLifetimeSec"
+ ])
+ (assertValueOneOf "Managed" boolValues)
+ (assertValueOneOf "OtherInformation" boolValues)
+ (assertValueOneOf "RouterPreference" ["high" "medium" "low" "normal" "default"])
+ (assertValueOneOf "EmitDNS" boolValues)
+ (assertValueOneOf "EmitDomains" boolValues)
+ (assertMinimum "DNSLifetimeSec" 0)
+ ];
+
checkDhcpServer = checkUnitConfig "DHCPServer" [
(assertOnlyFields [
"PoolOffset" "PoolSize" "DefaultLeaseTimeSec" "MaxLeaseTimeSec"
@@ -679,6 +693,18 @@ let
'';
};
+ ipv6PrefixDelegationConfig = mkOption {
+ default = {};
+ example = { EmitDNS = true; Managed = true; OtherInformation = true; };
+ type = types.addCheck (types.attrsOf unitOption) checkIpv6PrefixDelegation;
+ description = ''
+ Each attribute in this set specifies an option in the
+ <literal>[IPv6PrefixDelegation]</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; };
@@ -1014,6 +1040,11 @@ let
${attrsToSection def.dhcpV6Config}
''}
+ ${optionalString (def.ipv6PrefixDelegationConfig != {}) ''
+ [IPv6PrefixDelegation]
+ ${attrsToSection def.ipv6PrefixDelegationConfig}
+
+ ''}
${optionalString (def.dhcpServerConfig != { }) ''
[DHCPServer]
${attrsToSection def.dhcpServerConfig}