nixos/networkd: add BridgeVLAN options

This commit is contained in:
apfelkuchen06 2023-02-28 00:06:41 +01:00
parent cd650b3fa3
commit 0ddfb0a5df

View file

@ -1414,6 +1414,16 @@ let
(assertInt "Weight")
(assertRange "Weight" 1 1023)
];
sectionBridgeVLAN = checkUnitConfig "BridgeVLAN" [
(assertOnlyFields [
"VLAN"
"EgressUntagged"
"PVID"
])
(assertInt "PVID")
(assertRange "PVID" 0 4094)
];
};
};
@ -1879,6 +1889,21 @@ let
};
};
bridgeVLANOptions = {
options = {
bridgeMDBConfig = mkOption {
default = {};
example = { VLAN = 20; };
type = types.addCheck (types.attrsOf unitOption) check.network.sectionBridgeVLAN;
description = lib.mdDoc ''
Each attribute in this set specifies an option in the
`[BridgeVLAN]` section of the unit. See
{manpage}`systemd.network(5)` for details.
'';
};
};
};
networkOptions = commonNetworkOptions // {
linkConfig = mkOption {
@ -2357,6 +2382,27 @@ let
'';
};
bridgeVLANConfig = mkOption {
default = {};
example = { VLAN = "10-20"; };
type = types.addCheck (types.attrsOf unitOption) check.network.sectionbridgeVLAN;
description = lib.mdDoc ''
Each attribute in this set specifies an option in the
`[BridgeVLAN]` section of the unit. See
{manpage}`systemd.network(5)` for details.
'';
};
bridgeVLANs = mkOption {
default = [];
example = [ { bridgeVLANConfig = { VLAN = "10-20"; }; } ];
type = with types; listOf (submodule bridgeVLANOptions);
description = lib.mdDoc ''
A list of BridgeVLAN sections to be added to the unit. See
{manpage}`systemd.network(5)` for details.
'';
};
name = mkOption {
type = types.nullOr types.str;
default = null;
@ -2888,6 +2934,10 @@ let
[QuickFairQueueingClass]
${attrsToSection def.quickFairQueueingConfigClass}
''
+ flip concatMapStrings def.bridgeVLANs (x: ''
[BridgeVLAN]
${attrsToSection x.bridgeVLANConfig}
'')
+ def.extraConfig;
};