2022-04-26 09:55:22 +02:00
|
|
|
{ nglib, nixpkgs }:
|
|
|
|
nglib.makeSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
name = "ra-systems-dovecot";
|
|
|
|
inherit nixpkgs;
|
|
|
|
config = ({ pkgs, config, nglib, lib, ... }:
|
|
|
|
{
|
|
|
|
config = {
|
|
|
|
dumb-init = {
|
|
|
|
enable = true;
|
|
|
|
type.services = {};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.dovecot = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.dovecot;
|
|
|
|
config = {
|
|
|
|
protocols = "imap lmtp";
|
|
|
|
|
|
|
|
# auth
|
|
|
|
ssl = "no";
|
|
|
|
disable_plaintext_auth = "no";
|
|
|
|
auth_mechanisms = "plain login";
|
|
|
|
|
|
|
|
mail_location = "maildir:/maildir/%u";
|
|
|
|
|
|
|
|
protocol."imap" = { };
|
2022-11-28 00:38:21 +01:00
|
|
|
protocol."lmtp" = {
|
|
|
|
mail_plugins = [ "sieve" ];
|
|
|
|
};
|
2022-04-26 09:55:22 +02:00
|
|
|
|
2022-11-28 00:38:21 +01:00
|
|
|
plugin."" = {
|
2023-02-11 22:48:11 +01:00
|
|
|
sieve = "/mail-configuration/entry.sieve";
|
2022-11-28 00:38:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
mail_plugin_dir = pkgs.symlinkJoin {
|
|
|
|
name = "dovecot-modules";
|
|
|
|
paths = map (pkg: "${pkg}/lib/dovecot") ([ pkgs.dovecot pkgs.dovecot_pigeonhole ]);
|
|
|
|
};
|
2022-04-26 09:55:22 +02:00
|
|
|
|
|
|
|
# Optimizations:
|
|
|
|
# dotlock_use_excl = true;
|
|
|
|
maildir_copy_with_hardlinks = true;
|
|
|
|
|
|
|
|
lda_mailbox_autocreate = "yes";
|
|
|
|
lmtp_save_to_detail_mailbox = "yes";
|
|
|
|
service."lmtp" = {
|
|
|
|
inet_listener."lmtp" = {
|
|
|
|
address = [ "127.0.0.1" ];
|
|
|
|
port = 24;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
service."imap-login" = {
|
|
|
|
inet_listener."imap" = {
|
|
|
|
port = 143;
|
|
|
|
};
|
|
|
|
|
|
|
|
# inet_listener."imaps" = {
|
|
|
|
# port = 993;
|
|
|
|
# ssl = "yes";
|
|
|
|
# };
|
|
|
|
};
|
|
|
|
|
|
|
|
# Authentication configuration:
|
|
|
|
auth_debug = true;
|
|
|
|
log_path = "/proc/self/fd/1";
|
|
|
|
info_log_path = "/proc/self/fd/1";
|
|
|
|
debug_log_path = "/proc/self/fd/1";
|
|
|
|
|
|
|
|
passdb."" = {
|
|
|
|
driver = "passwd-file";
|
2023-02-15 18:51:08 +01:00
|
|
|
args = "scheme=plain username_format=%u /secrets/passwd.dovecot";
|
2022-04-26 09:55:22 +02:00
|
|
|
};
|
|
|
|
userdb."" = {
|
|
|
|
driver = "passwd-file";
|
|
|
|
args = "username_format=%u /secrets/passwd.dovecot";
|
2023-02-15 18:51:08 +01:00
|
|
|
default_fields = "uid=vmail gid=vmail home=/maildir/%u";
|
2022-04-26 09:55:22 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|