summaryrefslogtreecommitdiffstats
path: root/nixos/modules
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2020-03-07 15:06:58 +0100
committerAndreas Rammhold <andreas@rammhold.de>2020-05-01 13:33:55 +0200
commit10ad353d8bb256339a30b48da3747c809f2ad0ab (patch)
tree35b69667c017a9cc7c7d8029cf117375d62ca1b5 /nixos/modules
parent5abd9a74fc493c2e8be869bfb28a2f5d60ae0d6b (diff)
nixos/networkd: add ipv6Prefix
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/system/boot/networkd.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index ea86762db121..b06808fd64a0 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -324,6 +324,18 @@ let
(assertMinimum "DNSLifetimeSec" 0)
];
+ checkIpv6Prefix = checkUnitConfig "IPv6Prefix" [
+ (assertOnlyFields [
+ "AddressAutoconfiguration" "OnLink" "Prefix"
+ "PreferredLifetimeSec" "ValidLifetimeSec"
+ ])
+ (assertValueOneOf "AddressAutoconfiguration" boolValues)
+ (assertValueOneOf "OnLink" boolValues)
+ (assertMinimum "PreferredLifetimeSec" 0)
+ (assertMinimum "ValidLifetimeSec" 0)
+ ];
+
+
checkDhcpServer = checkUnitConfig "DHCPServer" [
(assertOnlyFields [
"PoolOffset" "PoolSize" "DefaultLeaseTimeSec" "MaxLeaseTimeSec"
@@ -647,6 +659,22 @@ let
};
};
+ ipv6PrefixOptions = {
+ options = {
+ ipv6PrefixConfig = mkOption {
+ default = {};
+ example = { Prefix = "fd00::/64"; };
+ type = types.addCheck (types.attrsOf unitOption) checkIpv6Prefix;
+ description = ''
+ Each attribute in this set specifies an option in the
+ <literal>[IPv6Prefix]</literal> section of the unit. See
+ <citerefentry><refentrytitle>systemd.network</refentrytitle>
+ <manvolnum>5</manvolnum></citerefentry> for details.
+ '';
+ };
+ };
+ };
+
networkOptions = commonNetworkOptions // {
@@ -705,6 +733,17 @@ let
'';
};
+ ipv6Prefixes = mkOption {
+ default = [];
+ example = { AddressAutoconfiguration = true; OnLink = true; };
+ type = with types; listOf (submodule ipv6PrefixOptions);
+ description = ''
+ A list of ipv6Prefix sections to be added to the unit. See
+ <citerefentry><refentrytitle>systemd.network</refentrytitle>
+ <manvolnum>5</manvolnum></citerefentry> for details.
+ '';
+ };
+
dhcpServerConfig = mkOption {
default = {};
example = { PoolOffset = 50; EmitDNS = false; };
@@ -1045,6 +1084,11 @@ let
${attrsToSection def.ipv6PrefixDelegationConfig}
''}
+ ${flip concatMapStrings def.ipv6Prefixes (x: ''
+ [IPv6Prefix]
+ ${attrsToSection x.ipv6PrefixConfig}
+
+ '')}
${optionalString (def.dhcpServerConfig != { }) ''
[DHCPServer]
${attrsToSection def.dhcpServerConfig}