diff options
author | apfelkuchen06 <apfelkuchen@hrnz.li> | 2023-02-28 00:06:39 +0100 |
---|---|---|
committer | apfelkuchen06 <apfelkuchen@hrnz.li> | 2023-03-16 03:28:21 +0100 |
commit | 55cd970d739f6c0cc60f846aa826e05e322b9559 (patch) | |
tree | a13448b6ce3f546f691c108f2ad795ae78908bf1 /nixos/modules/system/boot/networkd.nix | |
parent | b08e5be98d9eed403a2f334f2459da909114c002 (diff) | |
download | nixpkgs-55cd970d739f6c0cc60f846aa826e05e322b9559.tar nixpkgs-55cd970d739f6c0cc60f846aa826e05e322b9559.tar.gz nixpkgs-55cd970d739f6c0cc60f846aa826e05e322b9559.tar.bz2 nixpkgs-55cd970d739f6c0cc60f846aa826e05e322b9559.tar.lz nixpkgs-55cd970d739f6c0cc60f846aa826e05e322b9559.tar.xz nixpkgs-55cd970d739f6c0cc60f846aa826e05e322b9559.tar.zst nixpkgs-55cd970d739f6c0cc60f846aa826e05e322b9559.zip |
nixos/networkd: add NetworkEmulator options
Diffstat (limited to 'nixos/modules/system/boot/networkd.nix')
-rw-r--r-- | nixos/modules/system/boot/networkd.nix | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index 905ddf06e99..c52816e876e 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -1105,6 +1105,20 @@ let ]) (assertValueOneOf "Parent" [ "clsact" "ingress" ]) ]; + + sectionNetworkEmulator = checkUnitConfig "NetworkEmulator" [ + (assertOnlyFields [ + "Parent" + "Handle" + "DelaySec" + "DelayJitterSec" + "PacketLimit" + "LossRate" + "DuplicateRate" + ]) + (assertInt "PacketLimit") + (assertRange "PacketLimit" 0 4294967294) + ]; }; }; @@ -1784,6 +1798,17 @@ let ''; }; + networkEmulatorConfig = mkOption { + default = {}; + example = { Parent = "ingress"; DelaySec = "20msec"; }; + type = types.addCheck (types.attrsOf unitOption) check.network.sectionNetworkEmulator; + description = lib.mdDoc '' + Each attribute in this set specifies an option in the + `[NetworkEmulator]` section of the unit. See + {manpage}`systemd.network(5)` for details. + ''; + }; + name = mkOption { type = types.nullOr types.str; default = null; @@ -2219,6 +2244,10 @@ let [QDisc] ${attrsToSection def.qdiscConfig} '' + + optionalString (def.networkEmulatorConfig != { }) '' + [NetworkEmulator] + ${attrsToSection def.networkEmulatorConfig} + '' + def.extraConfig; }; |