summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Žlender <pub.git@zlender.si>2021-02-09 21:08:22 +0100
committerSimon Žlender <pub.git@zlender.si>2021-02-09 21:09:36 +0100
commit0c4b9a898527dcaf9a3491ad1cb37a6c3a7b1b63 (patch)
tree646a4f76a9569499a4ba80f65c7735cc8e217be6
parent5f431207b335424907f9da4a4fedde9bff2cea91 (diff)
Make opening ports in the firewall optional
-rw-r--r--default.nix6
-rw-r--r--mail-server/networking.nix2
2 files changed, 7 insertions, 1 deletions
diff --git a/default.nix b/default.nix
index 1ca367c..b0b64cf 100644
--- a/default.nix
+++ b/default.nix
@@ -25,6 +25,12 @@ in
options.mailserver = {
enable = mkEnableOption "nixos-mailserver";
+ openFirewall = mkOption {
+ type = types.bool;
+ default = true;
+ description = "Automatically open ports in the firewall.";
+ };
+
fqdn = mkOption {
type = types.str;
example = "mx.example.com";
diff --git a/mail-server/networking.nix b/mail-server/networking.nix
index 8c8a500..e8a222e 100644
--- a/mail-server/networking.nix
+++ b/mail-server/networking.nix
@@ -20,7 +20,7 @@ let
cfg = config.mailserver;
in
{
- config = with cfg; lib.mkIf enable {
+ config = with cfg; lib.mkIf (enable && openFirewall) {
networking.firewall = {
allowedTCPPorts = [ 25 ]