This commit is contained in:
Thomas Preisner 2024-12-28 01:42:00 +01:00
parent c90e09d125
commit 1e75d07d56
3 changed files with 22 additions and 1 deletions

View file

@ -103,6 +103,16 @@ in {
'';
};
quota = lib.mkOption {
type = with lib.types; nullOr types.str;
default = null;
example = "2G";
description = ''
Sets quota for the this login account. The size has to be suffixed with `k/M/G/T`.
Not setting a quota results in a standard quota of `100G`.
'';
};
isSystemUser = lib.mkOption {
type = lib.types.bool;
default = false;

View file

@ -19,7 +19,13 @@ with (import ./common.nix {inherit config;}); let
systemUsers = lib.filterAttrs (user: value: value.isSystemUser) cfg.accounts;
normalUsers = lib.filterAttrs (user: value: !value.isSystemUser) cfg.accounts;
genUserdbEntry = user: value: "${user}:::::::";
genUserdbEntry = user: value:
"${user}:::::::"
+ (
if lib.isString value.quota
then "userdb_quota_rule=*:storage=${value.quota}"
else ""
);
genPasswdEntry = user: value: "${user}:${"$(head -n 1 ${value.hashedPasswordFile})"}::::::";
genAuthDbsScript = pkgs.writeScript "generate-dovecot-auth-dbs" ''

View file

@ -141,6 +141,11 @@ in {
"reject_unauth_destination"
];
# quota checking # TODO: wo ist hier quota??
# smtpd_recipient_restrictions = [
# "check_policy_service inet:localhost:12340" # XXX
# ];
# TLS settings, inspired by https://github.com/jeaye/nix-files
# Submission by mail clients is handled in submissionOptions
smtpd_tls_security_level = "may";