diff options
author | Jared Baur <jaredbaur@fastmail.com> | 2022-07-31 14:11:01 -0700 |
---|---|---|
committer | Jared Baur <jaredbaur@fastmail.com> | 2022-07-31 14:11:01 -0700 |
commit | b1bb3bcad8b508def149a4c2eb520bdacfef6b85 (patch) | |
tree | 5f5d18dfe6dcace387b8521f888210a586f97e74 /nixos/modules/system | |
parent | c4665307de5c71bc8c47093ddf82026b5dc6c579 (diff) | |
download | nixlib-b1bb3bcad8b508def149a4c2eb520bdacfef6b85.tar nixlib-b1bb3bcad8b508def149a4c2eb520bdacfef6b85.tar.gz nixlib-b1bb3bcad8b508def149a4c2eb520bdacfef6b85.tar.bz2 nixlib-b1bb3bcad8b508def149a4c2eb520bdacfef6b85.tar.lz nixlib-b1bb3bcad8b508def149a4c2eb520bdacfef6b85.tar.xz nixlib-b1bb3bcad8b508def149a4c2eb520bdacfef6b85.tar.zst nixlib-b1bb3bcad8b508def149a4c2eb520bdacfef6b85.zip |
nixos/systemd.network: Add `IPv6RoutePrefix` options
Diffstat (limited to 'nixos/modules/system')
-rw-r--r-- | nixos/modules/system/boot/networkd.nix | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index 0336930b3ab7..2d2d472ff00d 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -858,6 +858,15 @@ let (assertValueOneOf "OnLink" boolValues) ]; + sectionIPv6RoutePrefix = checkUnitConfig "IPv6RoutePrefix" [ + (assertOnlyFields [ + "Route" + "LifetimeSec" + ]) + (assertHasField "Route") + (assertInt "LifetimeSec") + ]; + sectionDHCPServerStaticLease = checkUnitConfig "DHCPServerStaticLease" [ (assertOnlyFields [ "MACAddress" @@ -1246,6 +1255,22 @@ let }; }; + ipv6RoutePrefixOptions = { + options = { + ipv6RoutePrefixConfig = mkOption { + default = {}; + example = { Route = "fd00::/64"; }; + type = types.addCheck (types.attrsOf unitOption) check.network.sectionIPv6RoutePrefix; + description = '' + Each attribute in this set specifies an option in the + <literal>[IPv6RoutePrefix]</literal> section of the unit. See + <citerefentry><refentrytitle>systemd.network</refentrytitle> + <manvolnum>5</manvolnum></citerefentry> for details. + ''; + }; + }; + }; + dhcpServerStaticLeaseOptions = { options = { dhcpServerStaticLeaseConfig = mkOption { @@ -1399,6 +1424,17 @@ let ''; }; + ipv6RoutePrefixes = mkOption { + default = []; + example = [ { Route = "fd00::/64"; LifetimeSec = 3600; } ]; + type = with types; listOf (submodule ipv6RoutePrefixOptions); + description = '' + A list of ipv6RoutePrefix sections to be added to the unit. See + <citerefentry><refentrytitle>systemd.network</refentrytitle> + <manvolnum>5</manvolnum></citerefentry> for details. + ''; + }; + name = mkOption { type = types.nullOr types.str; default = null; @@ -1806,6 +1842,10 @@ let [IPv6Prefix] ${attrsToSection x.ipv6PrefixConfig} '') + + flip concatMapStrings def.ipv6RoutePrefixes (x: '' + [IPv6RoutePrefix] + ${attrsToSection x.ipv6RoutePrefixConfig} + '') + flip concatMapStrings def.dhcpServerStaticLeases (x: '' [DHCPServerStaticLease] ${attrsToSection x.dhcpServerStaticLeaseConfig} |