diff --git a/default.nix b/default.nix index 60d9cec..e10bd92 100644 --- a/default.nix +++ b/default.nix @@ -1026,14 +1026,34 @@ in }; }; - debug = mkOption { - type = types.bool; - default = false; - description = '' - Whether to enable verbose logging for mailserver related services. This - intended be used for development purposes only, you probably don't want - to enable this unless you're hacking on nixos-mailserver. - ''; + debug = { + all = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable verbose logging for all mailserver related services. + This intended be used for development purposes only, you probably + don't want to enable this unless you're hacking on nixos-mailserver. + ''; + }; + + dovecot = mkOption { + type = types.bool; + default = cfg.debug.all; + defaultText = lib.literalExpression "config.mailserver.debug.all"; + description = '' + Whether to enable verbose logging for Dovecot. + ''; + }; + + rspamd = mkOption { + type = types.bool; + default = cfg.debug.all; + defaultText = lib.literalExpression "config.mailserver.debug.all"; + description = '' + Whether to enable verbose logging for Rspamd. + ''; + }; }; maxConnectionsPerUser = mkOption { diff --git a/mail-server/dovecot.nix b/mail-server/dovecot.nix index d2da51b..da9f569 100644 --- a/mail-server/dovecot.nix +++ b/mail-server/dovecot.nix @@ -262,7 +262,7 @@ in extraConfig = '' #Extra Config - ${lib.optionalString cfg.debug '' + ${lib.optionalString cfg.debug.dovecot '' mail_debug = yes auth_debug = yes verbose_ssl = yes diff --git a/mail-server/rspamd.nix b/mail-server/rspamd.nix index 7ed2a0e..257cac7 100644 --- a/mail-server/rspamd.nix +++ b/mail-server/rspamd.nix @@ -67,7 +67,7 @@ in services.rspamd = { enable = true; - inherit (cfg) debug; + debug = cfg.debug.rspamd; locals = { "milter_headers.conf" = { text = '' diff --git a/tests/external.nix b/tests/external.nix index 82abb65..c01f9ac 100644 --- a/tests/external.nix +++ b/tests/external.nix @@ -39,7 +39,7 @@ mailserver = { enable = true; - debug = true; + debug.dovecot = true; # enabled for sieve script logging fqdn = "mail.example.com"; domains = [ "example.com" diff --git a/tests/lib/config.nix b/tests/lib/config.nix index fe66875..f13f15a 100644 --- a/tests/lib/config.nix +++ b/tests/lib/config.nix @@ -1,4 +1,21 @@ +{ + lib, + ... +}: + { # Testing eval failures that result from stateVersion assertion is out of scope mailserver.stateVersion = 999; + + # Enable second CPU core + virtualisation.cores = lib.mkDefault 2; + + # Don't make tests block on DNS requests that will never succeed + services.rspamd.locals."options.inc".text = '' + dns { + nameservers = ["127.0.0.1"]; + timeout = 0.0s; + retransmits = 0; + } + ''; }