diff options
author | Florian Klink <flokli@flokli.de> | 2022-08-30 11:10:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-30 11:10:47 +0200 |
commit | 087fa6565d2ee4331654674ff9ff788d42db1b25 (patch) | |
tree | 83b85fa79d51020a704931d541f7aad9be563d7e /nixos/modules/system | |
parent | 91fabbfb7fb640c5c4d09a35e4b493c43ad1965f (diff) | |
parent | 4f58def5e6e99ff0f142f9d3c947312f802a4f6a (diff) | |
download | nixlib-087fa6565d2ee4331654674ff9ff788d42db1b25.tar nixlib-087fa6565d2ee4331654674ff9ff788d42db1b25.tar.gz nixlib-087fa6565d2ee4331654674ff9ff788d42db1b25.tar.bz2 nixlib-087fa6565d2ee4331654674ff9ff788d42db1b25.tar.lz nixlib-087fa6565d2ee4331654674ff9ff788d42db1b25.tar.xz nixlib-087fa6565d2ee4331654674ff9ff788d42db1b25.tar.zst nixlib-087fa6565d2ee4331654674ff9ff788d42db1b25.zip |
Merge pull request #184340 from jmbaur/ipv6routeprefix
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 1fe7691fc9a7..71891ebbfefe 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -879,6 +879,15 @@ let (assertValueOneOf "OnLink" boolValues) ]; + sectionIPv6RoutePrefix = checkUnitConfig "IPv6RoutePrefix" [ + (assertOnlyFields [ + "Route" + "LifetimeSec" + ]) + (assertHasField "Route") + (assertInt "LifetimeSec") + ]; + sectionDHCPServerStaticLease = checkUnitConfig "DHCPServerStaticLease" [ (assertOnlyFields [ "MACAddress" @@ -1242,6 +1251,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 { @@ -1384,6 +1409,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; @@ -1775,6 +1811,10 @@ let [IPv6Prefix] ${attrsToSection x.ipv6PrefixConfig} '') + + flip concatMapStrings def.ipv6RoutePrefixes (x: '' + [IPv6RoutePrefix] + ${attrsToSection x.ipv6RoutePrefixConfig} + '') + flip concatMapStrings def.dhcpServerStaticLeases (x: '' [DHCPServerStaticLease] ${attrsToSection x.dhcpServerStaticLeaseConfig} |