hosts/ni/networking/setup: add common setup option

This commit is contained in:
Gabriel Arazas 2024-07-30 18:35:02 +08:00
parent c64c8018b8
commit dea3b55aed
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360

View File

@ -7,6 +7,17 @@ in
{ {
options.hosts.ni.networking = { options.hosts.ni.networking = {
enable = lib.mkEnableOption "networking setup"; enable = lib.mkEnableOption "networking setup";
enableCommonSetup = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to enable opening TCP ports and configuring network-related
settings typically used for easy networking with clients.
'';
example = false;
};
setup = lib.mkOption { setup = lib.mkOption {
type = lib.types.enum [ "networkd" "networkmanager" ]; type = lib.types.enum [ "networkd" "networkmanager" ];
description = '' description = ''
@ -139,5 +150,18 @@ in
interfaces = [ "enp1s0" "wlp2s0" ]; interfaces = [ "enp1s0" "wlp2s0" ];
}; };
}) })
(lib.mkIf cfg.enableCommonSetup {
state.ports = {
http = {
value = 80;
openFirewall = true;
};
https = {
value = 443;
openFirewall = true;
};
};
})
]); ]);
} }