From bc130855a7d683618157362cb83fdf42caa5cb1a Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 25 Jan 2020 16:46:39 +0100 Subject: [PATCH] nixos/networkd: add `vrfConfig` option to netdevs --- nixos/modules/system/boot/networkd.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index 56a9d6b11380..a684238a2ada 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -55,6 +55,11 @@ let (assertMacAddress "MACAddress") ]; + checkVRF = checkUnitConfig "VRF" [ + (assertOnlyFields [ "Table" ]) + (assertMinimum "Table" 0) + ]; + # NOTE The PrivateKey directive is missing on purpose here, please # do not add it to this list. The nix store is world-readable let's # refrain ourselves from providing a footgun. @@ -349,6 +354,21 @@ let ''; }; + vrfConfig = mkOption { + default = {}; + example = { Table = 2342; }; + type = types.addCheck (types.attrsOf unitOption) checkVRF; + description = '' + Each attribute in this set specifies an option in the + [VRF] section of the unit. See + systemd.netdev + 5 for details. + A detailed explanation about how VRFs work can be found in the + kernel + docs. + ''; + }; + wireguardConfig = mkOption { default = {}; example = { @@ -844,6 +864,11 @@ let [Xfrm] ${attrsToSection def.xfrmConfig} + ''} + ${optionalString (def.vrfConfig != { }) '' + [VRF] + ${attrsToSection def.vrfConfig} + ''} ${optionalString (def.wireguardConfig != { }) '' [WireGuard]