refactor: extract 'firewall' and 'wol' modules
This commit is contained in:
27
modules/firewall/default.nix
Normal file
27
modules/firewall/default.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
in
|
||||
{
|
||||
options.firewall = {
|
||||
enable = mkEnableOption "firewall";
|
||||
|
||||
allowedTCPPorts = mkOption {
|
||||
type = types.listOf types.port;
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
allowedUDPPorts = mkOption {
|
||||
type = types.listOf types.port;
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.firewall.enable {
|
||||
networking.firewall = {
|
||||
enable = true;
|
||||
inherit (config.firewall) allowedTCPPorts allowedUDPPorts;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user