summary refs log tree commit diff
path: root/nixos/modules/system/boot/networkd.nix
diff options
context:
space:
mode:
authorapfelkuchen06 <apfelkuchen@hrnz.li>2023-02-28 00:06:39 +0100
committerapfelkuchen06 <apfelkuchen@hrnz.li>2023-03-16 03:28:22 +0100
commit2784862e410bd07b562e6f537d6ff756fffa66ba (patch)
tree57ccfc6d01924f432abff33c18c4f400912c43df /nixos/modules/system/boot/networkd.nix
parentd63035329e6c7c07bf5cd3c4e06f4b8d2e71653f (diff)
downloadnixpkgs-2784862e410bd07b562e6f537d6ff756fffa66ba.tar
nixpkgs-2784862e410bd07b562e6f537d6ff756fffa66ba.tar.gz
nixpkgs-2784862e410bd07b562e6f537d6ff756fffa66ba.tar.bz2
nixpkgs-2784862e410bd07b562e6f537d6ff756fffa66ba.tar.lz
nixpkgs-2784862e410bd07b562e6f537d6ff756fffa66ba.tar.xz
nixpkgs-2784862e410bd07b562e6f537d6ff756fffa66ba.tar.zst
nixpkgs-2784862e410bd07b562e6f537d6ff756fffa66ba.zip
nixos/networkd: add PIE options
Diffstat (limited to 'nixos/modules/system/boot/networkd.nix')
-rw-r--r--nixos/modules/system/boot/networkd.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index 573290133f8..d871bc2f360 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -1133,6 +1133,16 @@ let
           "MTUBytes"
         ])
       ];
+
+      sectionPIE = checkUnitConfig "PIE" [
+        (assertOnlyFields [
+          "Parent"
+          "Handle"
+          "PacketLimit"
+        ])
+        (assertInt "PacketLimit")
+        (assertRange "PacketLimit" 1 4294967294)
+      ];
     };
   };
 
@@ -1834,6 +1844,17 @@ let
       '';
     };
 
+    pieConfig = mkOption {
+      default = {};
+      example = { Parent = "ingress"; PacketLimit = "3847"; };
+      type = types.addCheck (types.attrsOf unitOption) check.network.sectionPIE;
+      description = lib.mdDoc ''
+        Each attribute in this set specifies an option in the
+        `[PIE]` section of the unit.  See
+        {manpage}`systemd.network(5)` for details.
+      '';
+    };
+
     name = mkOption {
       type = types.nullOr types.str;
       default = null;
@@ -2277,6 +2298,10 @@ let
           [TokenBucketFilter]
           ${attrsToSection def.tockenBucketFilterConfig}
         ''
+        + optionalString (def.pieConfig != { }) ''
+          [PIE]
+          ${attrsToSection def.pieConfig}
+        ''
         + def.extraConfig;
     };