Initial commit

This commit is contained in:
2026-02-01 00:42:40 +08:00
commit 17c5379a9a
11 changed files with 514 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
{ config, lib, ... }:
let
cfg = config.my.network.firewall;
in
{
options.my.network.firewall = {
allowedTCPPorts = lib.mkOption {
type = lib.types.listOf lib.types.port;
default = [ ];
};
allowedUDPPorts = lib.mkOption {
type = lib.types.listOf lib.types.port;
default = [ ];
};
trustedInterfaces = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
allowPing = lib.mkOption {
type = lib.types.bool;
default = false;
};
};
config = {
networking.firewall = {
enable = true;
allowedTCPPorts = cfg.allowedTCPPorts;
allowedUDPPorts = cfg.allowedUDPPorts;
trustedInterfaces = cfg.trustedInterfaces;
allowPing = cfg.allowPing;
};
};
}