From dea3b55aedc2f62160adb837ee5e4127a4945555 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Tue, 30 Jul 2024 18:35:02 +0800 Subject: [PATCH] hosts/ni/networking/setup: add common setup option --- configs/nixos/ni/modules/networking/setup.nix | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/configs/nixos/ni/modules/networking/setup.nix b/configs/nixos/ni/modules/networking/setup.nix index e1888383..159171a1 100644 --- a/configs/nixos/ni/modules/networking/setup.nix +++ b/configs/nixos/ni/modules/networking/setup.nix @@ -7,6 +7,17 @@ in { options.hosts.ni.networking = { 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 { type = lib.types.enum [ "networkd" "networkmanager" ]; description = '' @@ -139,5 +150,18 @@ in interfaces = [ "enp1s0" "wlp2s0" ]; }; }) + + (lib.mkIf cfg.enableCommonSetup { + state.ports = { + http = { + value = 80; + openFirewall = true; + }; + https = { + value = 443; + openFirewall = true; + }; + }; + }) ]); }