From 83d89e9b22c631fb71c689321ff3a2d1a2571029 Mon Sep 17 00:00:00 2001 From: Vaibhav Sagar Date: Sun, 10 Sep 2017 11:30:46 +0800 Subject: [PATCH 1/2] znc: open firewall with configured port The configuration doesn't currently open the configured port, which is less convenient than opening it. --- nixos/modules/services/networking/znc.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/modules/services/networking/znc.nix b/nixos/modules/services/networking/znc.nix index 2b9867ade10d..2b4ca4a5fe52 100644 --- a/nixos/modules/services/networking/znc.nix +++ b/nixos/modules/services/networking/znc.nix @@ -350,6 +350,8 @@ in config = mkIf cfg.enable { + networking.firewall.allowedTCPPorts = [ cfg.port ]; + systemd.services.znc = { description = "ZNC Server"; wantedBy = [ "multi-user.target" ]; From c7dd5e146bd6cdaacffaa681e56dbd1c916ace17 Mon Sep 17 00:00:00 2001 From: Vaibhav Sagar Date: Sun, 10 Sep 2017 18:41:39 +0800 Subject: [PATCH 2/2] znc: add openFirewall configuration option --- nixos/modules/services/networking/znc.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/znc.nix b/nixos/modules/services/networking/znc.nix index 2b4ca4a5fe52..fd6d6e8e43b5 100644 --- a/nixos/modules/services/networking/znc.nix +++ b/nixos/modules/services/networking/znc.nix @@ -276,6 +276,14 @@ in ''; }; + openFirewall = mkOption { + type = types.bool; + default = false; + description = '' + Whether to open ports in the firewall for ZNC. + ''; + }; + passBlock = mkOption { example = defaultPassBlock; type = types.string; @@ -350,7 +358,9 @@ in config = mkIf cfg.enable { - networking.firewall.allowedTCPPorts = [ cfg.port ]; + networking.firewall = mkIf cfg.openFirewall { + allowedTCPPorts = [ cfg.port ]; + }; systemd.services.znc = { description = "ZNC Server";