nixos/stalwart-mail: support adding secrets (#380588)

This commit is contained in:
Ilan Joselevich 2025-02-23 16:00:01 +07:00 committed by GitHub
commit ddef0335cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,6 +53,21 @@ in
Data directory for stalwart
'';
};
credentials = lib.mkOption {
description = ''
Credentials envs used to configure Stalwart-Mail secrets.
These secrets can be accessed in configuration values with
the macros such as
`%{file:/run/credentials/stalwart-mail.service/VAR_NAME}%`.
'';
type = lib.types.attrsOf lib.types.str;
default = { };
example = {
user_admin_password = "/run/keys/stalwart_admin_password";
};
};
};
config = lib.mkIf cfg.enable {
@ -149,6 +164,7 @@ in
""
"${cfg.package}/bin/stalwart-mail --config=${configFile}"
];
LoadCredential = lib.mapAttrsToList (key: value: "${key}:${value}") cfg.credentials;
StandardOutput = "journal";
StandardError = "journal";