nixos/networkd: add HierarchyTokenBucket options

This commit is contained in:
apfelkuchen06 2023-02-28 00:06:41 +01:00
parent 29e5451963
commit 24df07c786

View file

@ -1361,6 +1361,16 @@ let
"Id" "Id"
]) ])
]; ];
sectionHierarchyTokenBucket = checkUnitConfig "HierarchyTokenBucket" [
(assertOnlyFields [
"Parent"
"Handle"
"DefaultClass"
"RateToQuantum"
])
(assertInt "RateToQuantum")
];
}; };
}; };
@ -2249,6 +2259,17 @@ let
''; '';
}; };
hierarchyTokenBucketConfig = mkOption {
default = {};
example = { Parent = "root"; };
type = types.addCheck (types.attrsOf unitOption) check.network.sectionHierarchyTokenBucket;
description = lib.mdDoc ''
Each attribute in this set specifies an option in the
`[HierarchyTokenBucket]` section of the unit. See
{manpage}`systemd.network(5)` for details.
'';
};
name = mkOption { name = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
@ -2760,6 +2781,10 @@ let
[TrivialLinkEqualizer] [TrivialLinkEqualizer]
${attrsToSection def.trivialLinkEqualizerConfig} ${attrsToSection def.trivialLinkEqualizerConfig}
'' ''
+ optionalString (def.hierarchyTokenBucketConfig != { }) ''
[HierarchyTokenBucket]
${attrsToSection def.hierarchyTokenBucketConfig}
''
+ def.extraConfig; + def.extraConfig;
}; };