diff options
author | Nikolay Amiantov <ab@fmap.me> | 2016-01-10 07:05:12 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2016-01-21 12:53:26 +0300 |
commit | b781cf1a12ce77fd29ec0656bb04895b0cdaecf7 (patch) | |
tree | 48e22df9ea0e8f5bcd51a91bf1fccdcd27b74b64 /nixos/modules/services | |
parent | 39bbac96afce0624b7ea57461431efcdabdd5fc8 (diff) | |
download | nixpkgs-b781cf1a12ce77fd29ec0656bb04895b0cdaecf7.tar nixpkgs-b781cf1a12ce77fd29ec0656bb04895b0cdaecf7.tar.gz nixpkgs-b781cf1a12ce77fd29ec0656bb04895b0cdaecf7.tar.bz2 nixpkgs-b781cf1a12ce77fd29ec0656bb04895b0cdaecf7.tar.lz nixpkgs-b781cf1a12ce77fd29ec0656bb04895b0cdaecf7.tar.xz nixpkgs-b781cf1a12ce77fd29ec0656bb04895b0cdaecf7.tar.zst nixpkgs-b781cf1a12ce77fd29ec0656bb04895b0cdaecf7.zip |
nixos/dovecot: add sieveScripts support
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/mail/dovecot.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix index a2a93a520e9..efe6a3beb9a 100644 --- a/nixos/modules/services/mail/dovecot.nix +++ b/nixos/modules/services/mail/dovecot.nix @@ -51,6 +51,12 @@ let } '') + (optionalString (cfg.sieveScripts != {}) '' + plugin { + ${concatStringsSep "\n" (mapAttrsToList (to: from: "sieve_${to} = ${stateDir}/sieve/${to}") cfg.sieveScripts)} + } + '') + cfg.extraConfig ]; @@ -165,6 +171,12 @@ in description = "Whether to create a own Dovecot PAM service and configure PAM user logins."; }; + sieveScripts = mkOption { + type = types.attrsOf types.path; + default = {}; + description = "Sieve scripts to be executed. Key is a sequence, e.g. 'before2', 'after' etc."; + }; + showPAMFailure = mkOption { type = types.bool; default = false; @@ -219,6 +231,22 @@ in StartLimitInterval = "1min"; RuntimeDirectory = [ "dovecot2" ]; }; + + preStart = '' + rm -rf ${stateDir}/sieve + '' + optionalString (cfg.sieveScripts != {}) '' + mkdir -p ${stateDir}/sieve + ${concatStringsSep "\n" (mapAttrsToList (to: from: '' + if [ -d '${from}' ]; then + mkdir '${stateDir}/sieve/${to}' + cp ${from}/*.sieve '${stateDir}/sieve/${to}' + else + cp '${from}' '${stateDir}/sieve/${to}' + fi + ${pkgs.dovecot_pigeonhole}/bin/sievec '${stateDir}/sieve/${to}' + '') cfg.sieveScripts)} + chown -R '${cfg.user}:${cfg.group}' ${stateDir}/sieve + ''; }; environment.systemPackages = [ dovecotPkg ]; |