From 9c7d08c153f7960ee3643cc3d95ce4166015ca9d Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Mon, 22 Jul 2024 18:57:31 +0100 Subject: [PATCH] fix: slight bit of formatting and a renaming Closes #84 --- applications/email.nix | 48 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/applications/email.nix b/applications/email.nix index e47a7ae..bd03f77 100644 --- a/applications/email.nix +++ b/applications/email.nix @@ -92,7 +92,7 @@ with lib; let } ]; - configFile = + sieveConfigFile = # https://doc.dovecot.org/configuration_manual/sieve/examples/#plus-addressed-mail-filtering pkgs.writeText "basic_sieve" '' @@ -105,32 +105,32 @@ with lib; let # this should be close to teh last step if allof ( - address :localpart ["To"] ["${toString create_config_to}"], - address :domain ["To"] "skynet.ie" - ){ - if address :matches ["To"] "*@skynet.ie" { - if header :is "X-Spam" "Yes" { - fileinto :create "''${1}.Junk"; - stop; - } else { - fileinto :create "''${1}"; - stop; - } + address :localpart ["To"] ["${toString create_config_to}"], + address :domain ["To"] "skynet.ie" + ){ + if address :matches ["To"] "*@skynet.ie" { + if header :is "X-Spam" "Yes" { + fileinto :create "''${1}.Junk"; + stop; + } else { + fileinto :create "''${1}"; + stop; } + } } if allof ( - address :localpart ["From"] ["${toString create_config_to}"], - address :domain ["From"] "skynet.ie" - ){ - if address :matches ["From"] "*@skynet.ie" { - if header :is "X-Spam" "Yes" { - fileinto :create "''${1}.Junk"; - stop; - } else { - fileinto :create "''${1}"; - stop; - } + address :localpart ["From"] ["${toString create_config_to}"], + address :domain ["From"] "skynet.ie" + ){ + if address :matches ["From"] "*@skynet.ie" { + if header :is "X-Spam" "Yes" { + fileinto :create "''${1}.Junk"; + stop; + } else { + fileinto :create "''${1}"; + stop; } + } } ''; in { @@ -477,7 +477,7 @@ in { }; services.dovecot2.sieve.scripts = { - before = configFile; + before = sieveConfigFile; }; # This is to add a bcc to outgoing mail