Merge branch 'lmtpMemoryLimit' into 'master'

Make memory limits configurable for LMTP, quota-status, and IMAP dovecot services

See merge request simple-nixos-mailserver/nixos-mailserver!321
This commit is contained in:
Ryan Trinkle 2024-12-26 16:26:00 +00:00
commit 232784c81b
2 changed files with 33 additions and 0 deletions

View File

@ -460,6 +460,22 @@ in
''; '';
}; };
lmtpMemoryLimit = mkOption {
type = types.int;
default = 256;
description = ''
The memory limit for the LMTP service, in megabytes.
'';
};
quotaStatusMemoryLimit = mkOption {
type = types.int;
default = 256;
description = ''
The memory limit for the quota-status service, in megabytes.
'';
};
extraVirtualAliases = mkOption { extraVirtualAliases = mkOption {
type = let type = let
loginAccount = mkOptionType { loginAccount = mkOptionType {
@ -696,6 +712,14 @@ in
''; '';
}; };
imapMemoryLimit = mkOption {
type = types.int;
default = 256;
description = ''
The memory limit for the imap service, in megabytes.
'';
};
enableImapSsl = mkOption { enableImapSsl = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;

View File

@ -276,6 +276,10 @@ in
mail_plugins = $mail_plugins imap_sieve mail_plugins = $mail_plugins imap_sieve
} }
service imap {
vsz_limit = ${builtins.toString cfg.imapMemoryLimit} MB
}
protocol pop3 { protocol pop3 {
mail_max_userip_connections = ${toString cfg.maxConnectionsPerUser} mail_max_userip_connections = ${toString cfg.maxConnectionsPerUser}
} }
@ -291,8 +295,13 @@ in
mode = 0600 mode = 0600
user = ${postfixCfg.user} user = ${postfixCfg.user}
} }
vsz_limit = ${builtins.toString cfg.lmtpMemoryLimit} MB
} }
service quota-status {
vsz_limit = ${builtins.toString cfg.quotaStatusMemoryLimit} MB
}
recipient_delimiter = ${cfg.recipientDelimiter} recipient_delimiter = ${cfg.recipientDelimiter}
lmtp_save_to_detail_mailbox = ${cfg.lmtpSaveToDetailMailbox} lmtp_save_to_detail_mailbox = ${cfg.lmtpSaveToDetailMailbox}