mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/dovecot: add 'protocols' option
This commit is contained in:
parent
122929cda7
commit
b2b58642fe
1 changed files with 13 additions and 8 deletions
|
@ -9,16 +9,10 @@ let
|
||||||
baseDir = "/run/dovecot2";
|
baseDir = "/run/dovecot2";
|
||||||
stateDir = "/var/lib/dovecot";
|
stateDir = "/var/lib/dovecot";
|
||||||
|
|
||||||
protocols = concatStrings [
|
|
||||||
(optionalString cfg.enableImap "imap")
|
|
||||||
(optionalString cfg.enablePop3 "pop3")
|
|
||||||
(optionalString cfg.enableLmtp "lmtp")
|
|
||||||
];
|
|
||||||
|
|
||||||
dovecotConf = concatStrings [
|
dovecotConf = concatStrings [
|
||||||
''
|
''
|
||||||
base_dir = ${baseDir}
|
base_dir = ${baseDir}
|
||||||
protocols = ${protocols}
|
protocols = ${concatStringsSep " " cfg.protocols}
|
||||||
''
|
''
|
||||||
|
|
||||||
(if isNull cfg.sslServerCert then ''
|
(if isNull cfg.sslServerCert then ''
|
||||||
|
@ -87,6 +81,12 @@ in
|
||||||
description = "Start the LMTP listener (when Dovecot is enabled).";
|
description = "Start the LMTP listener (when Dovecot is enabled).";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protocols = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ ];
|
||||||
|
description = "Additional listeners to start when Dovecot is enabled.";
|
||||||
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.dovecot22;
|
default = pkgs.dovecot22;
|
||||||
|
@ -177,6 +177,11 @@ in
|
||||||
|
|
||||||
security.pam.services.dovecot2 = mkIf cfg.enablePAM {};
|
security.pam.services.dovecot2 = mkIf cfg.enablePAM {};
|
||||||
|
|
||||||
|
services.dovecot2.protocols =
|
||||||
|
optional cfg.enableImap "imap"
|
||||||
|
++ optional cfg.enablePop3 "pop3"
|
||||||
|
++ optional cfg.enableLmtp "lmtp";
|
||||||
|
|
||||||
users.extraUsers = [
|
users.extraUsers = [
|
||||||
{ name = "dovenull";
|
{ name = "dovenull";
|
||||||
uid = config.ids.uids.dovenull2;
|
uid = config.ids.uids.dovenull2;
|
||||||
|
@ -220,7 +225,7 @@ in
|
||||||
environment.systemPackages = [ dovecotPkg ];
|
environment.systemPackages = [ dovecotPkg ];
|
||||||
|
|
||||||
assertions = [
|
assertions = [
|
||||||
{ assertion = cfg.enablePop3 || cfg.enableImap;
|
{ assertion = intersectLists cfg.protocols [ "pop3" "imap" ] != [];
|
||||||
message = "dovecot needs at least one of the IMAP or POP3 listeners enabled";
|
message = "dovecot needs at least one of the IMAP or POP3 listeners enabled";
|
||||||
}
|
}
|
||||||
{ assertion = isNull cfg.sslServerCert == isNull cfg.sslServerKey
|
{ assertion = isNull cfg.sslServerCert == isNull cfg.sslServerKey
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue