@@ -38,7 +38,7 @@ let
3838 ssl_cert = <${cfg.sslServerCert}
3939 ssl_key = <${cfg.sslServerKey}
4040 ${optionalString (cfg.sslCACert != null) ("ssl_ca = <" + cfg.sslCACert)}
41− ssl_dh = <${config.security.dhparams.params.dovecot2.path}
41+ ${optionalString cfg.enableDHE ''ssl_dh = <${config.security.dhparams.params.dovecot2.path}''}
4242 disable_plaintext_auth = yes
4343 ''
4444 )
@@ -169,25 +169,13 @@ in
169169 ];
170170
171171 options.services.dovecot2 = {
172− enable = mkEnableOption "Dovecot 2.x POP3/IMAP server";
172+ enable = mkEnableOption "the dovecot 2.x POP3/IMAP server";
173173
174− enablePop3 = mkOption {
175− type = types.bool;
176− default = false;
177− description = "Start the POP3 listener (when Dovecot is enabled).";
178− };
174+ enablePop3 = mkEnableOption "starting the POP3 listener (when Dovecot is enabled).";
179175
180− enableImap = mkOption {
181− type = types.bool;
182− default = true;
183− description = "Start the IMAP listener (when Dovecot is enabled).";
184− };
176+ enableImap = mkEnableOption "starting the IMAP listener (when Dovecot is enabled)." // { default = true; };
185177
186− enableLmtp = mkOption {
187− type = types.bool;
188− default = false;
189− description = "Start the LMTP listener (when Dovecot is enabled).";
190− };
178+ enableLmtp = mkEnableOption "starting the LMTP listener (when Dovecot is enabled).";
191179
192180 protocols = mkOption {
193181 type = types.listOf types.str;
@@ -279,13 +267,9 @@ in
279267 description = "Default group to store mail for virtual users.";
280268 };
281269
282− createMailUser = mkOption {
283− type = types.bool;
284− default = true;
285− description = ''Whether to automatically create the user
286− given in <option>services.dovecot.user</option> and the group
287− given in <option>services.dovecot.group</option>.'';
288− };
270+ createMailUser = mkEnableOption ''automatically creating the user
271+ given in <option>services.dovecot.user</option> and the group
272+ given in <option>services.dovecot.group</option>.'' // { default = true; };
289273
290274 modules = mkOption {
291275 type = types.listOf types.package;
@@ -316,11 +300,9 @@ in
316300 description = "Path to the server's private key.";
317301 };
318302
319− enablePAM = mkOption {
320− type = types.bool;
321− default = true;
322− description = "Whether to create a own Dovecot PAM service and configure PAM user logins.";
323− };
303+ enablePAM = mkEnableOption "creating a own Dovecot PAM service and configure PAM user logins." // { default = true; };
304+
305+ enableDHE = mkEnableOption "enable ssl_dh and generation of primes for the key exchange." // { default = true; };
324306
325307 sieveScripts = mkOption {
326308 type = types.attrsOf types.path;
@@ -328,11 +310,7 @@ in
328310 description = "Sieve scripts to be executed. Key is a sequence, e.g. 'before2', 'after' etc.";
329311 };
330312
331− showPAMFailure = mkOption {
332− type = types.bool;
333− default = false;
334− description = "Show the PAM failure message on authentication error (useful for OTPW).";
335− };
313+ showPAMFailure = mkEnableOption "showing the PAM failure message on authentication error (useful for OTPW).";
336314
337315 mailboxes = mkOption {
338316 type = with types; coercedTo
@@ -348,12 +326,7 @@ in
348326 description = "Configure mailboxes and auto create or subscribe them.";
349327 };
350328
351− enableQuota = mkOption {
352− type = types.bool;
353− default = false;
354− example = true;
355− description = "Whether to enable the dovecot quota service.";
356− };
329+ enableQuota = mkEnableOption "the dovecot quota service.";
357330
358331 quotaPort = mkOption {
359332 type = types.str;
@@ -376,7 +349,7 @@ in
376349 config = mkIf cfg.enable {
377350 security.pam.services.dovecot2 = mkIf cfg.enablePAM {};
378351
379− security.dhparams = mkIf (cfg.sslServerCert != null) {
352+ security.dhparams = mkIf (cfg.sslServerCert != null && cfg.enableDHE) {
380353 enable = true;
381354 params.dovecot2 = {};
382355 };