summary refs log tree commit diff
path: root/nixos/modules/services/mail/dovecot.nix
diff options
context:
space:
mode:
authorPeter Jones <pjones@devalot.com>2017-01-13 14:19:29 -0700
committerPeter Jones <pjones@devalot.com>2017-01-13 14:19:29 -0700
commit75aaae34a973fcf967bd264d45fda23577d4be33 (patch)
tree51f03a667cb130afc1c3684fceb46894c83b6bf7 /nixos/modules/services/mail/dovecot.nix
parent89dfe67f81addb0ffacbfa14079579c24c2a4530 (diff)
downloadnixpkgs-75aaae34a973fcf967bd264d45fda23577d4be33.tar
nixpkgs-75aaae34a973fcf967bd264d45fda23577d4be33.tar.gz
nixpkgs-75aaae34a973fcf967bd264d45fda23577d4be33.tar.bz2
nixpkgs-75aaae34a973fcf967bd264d45fda23577d4be33.tar.lz
nixpkgs-75aaae34a973fcf967bd264d45fda23577d4be33.tar.xz
nixpkgs-75aaae34a973fcf967bd264d45fda23577d4be33.tar.zst
nixpkgs-75aaae34a973fcf967bd264d45fda23577d4be33.zip
dovecot: Fix sieve scripts
Make sure that the output of the sieve compiler produces files that
have a newer time stamp than the source sieve script.  Otherwise you
get errors in the logs about Dovecot not being able to compile do to a
permission issue.
Diffstat (limited to 'nixos/modules/services/mail/dovecot.nix')
-rw-r--r--nixos/modules/services/mail/dovecot.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix
index 4c9df935deb..f2097638c63 100644
--- a/nixos/modules/services/mail/dovecot.nix
+++ b/nixos/modules/services/mail/dovecot.nix
@@ -241,6 +241,9 @@ in
         RuntimeDirectory = [ "dovecot2" ];
       };
 
+      # When copying sieve scripts preserve the original time stamp
+      # (should be 0) so that the compiled sieve script is newer than
+      # the source file and Dovecot won't try to compile it.
       preStart = ''
         rm -rf ${stateDir}/sieve
       '' + optionalString (cfg.sieveScripts != {}) ''
@@ -248,11 +251,11 @@ in
         ${concatStringsSep "\n" (mapAttrsToList (to: from: ''
           if [ -d '${from}' ]; then
             mkdir '${stateDir}/sieve/${to}'
-            cp "${from}/"*.sieve '${stateDir}/sieve/${to}'
+            cp -p "${from}/"*.sieve '${stateDir}/sieve/${to}'
           else
-            cp '${from}' '${stateDir}/sieve/${to}'
+            cp -p '${from}' '${stateDir}/sieve/${to}'
           fi
-           ${pkgs.dovecot_pigeonhole}/bin/sievec '${stateDir}/sieve/${to}'
+          ${pkgs.dovecot_pigeonhole}/bin/sievec '${stateDir}/sieve/${to}'
         '') cfg.sieveScripts)}
         chown -R '${cfg.mailUser}:${cfg.mailGroup}' '${stateDir}/sieve'
       '';