mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
nixos/dovecot: add sieveScripts support
This commit is contained in:
parent
39bbac96af
commit
b781cf1a12
@ -51,6 +51,12 @@ let
|
|||||||
}
|
}
|
||||||
'')
|
'')
|
||||||
|
|
||||||
|
(optionalString (cfg.sieveScripts != {}) ''
|
||||||
|
plugin {
|
||||||
|
${concatStringsSep "\n" (mapAttrsToList (to: from: "sieve_${to} = ${stateDir}/sieve/${to}") cfg.sieveScripts)}
|
||||||
|
}
|
||||||
|
'')
|
||||||
|
|
||||||
cfg.extraConfig
|
cfg.extraConfig
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -165,6 +171,12 @@ in
|
|||||||
description = "Whether to create a own Dovecot PAM service and configure PAM user logins.";
|
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 {
|
showPAMFailure = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
@ -219,6 +231,22 @@ in
|
|||||||
StartLimitInterval = "1min";
|
StartLimitInterval = "1min";
|
||||||
RuntimeDirectory = [ "dovecot2" ];
|
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 ];
|
environment.systemPackages = [ dovecotPkg ];
|
||||||
|
Loading…
Reference in New Issue
Block a user