aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/by-name/st/stalwart-mail/module.nix6
-rw-r--r--modules/by-name/st/stalwart-mail/settings.nix31
2 files changed, 28 insertions, 9 deletions
diff --git a/modules/by-name/st/stalwart-mail/module.nix b/modules/by-name/st/stalwart-mail/module.nix
index ae3ccea..1e39e81 100644
--- a/modules/by-name/st/stalwart-mail/module.nix
+++ b/modules/by-name/st/stalwart-mail/module.nix
@@ -41,8 +41,8 @@ in {
};
principals = lib.mkOption {
- default = [];
- type = lib.types.listOf (lib.types.submodule {
+ default = null;
+ type = lib.types.nullOr (lib.types.listOf (lib.types.submodule {
options = {
name = lib.mkOption {
type = lib.types.str;
@@ -77,7 +77,7 @@ in {
'';
};
};
- });
+ }));
};
dataDirectory = lib.mkOption {
diff --git a/modules/by-name/st/stalwart-mail/settings.nix b/modules/by-name/st/stalwart-mail/settings.nix
index 7032ae0..17f045d 100644
--- a/modules/by-name/st/stalwart-mail/settings.nix
+++ b/modules/by-name/st/stalwart-mail/settings.nix
@@ -18,6 +18,11 @@
if cfg.security != null
then cfg.security.verificationMode
else "disable";
+
+ directory =
+ if cfg.principals == null
+ then "internal"
+ else "in-memory";
in {
config.services.stalwart-mail.settings = lib.mkIf cfg.enable {
# https://www.rfc-editor.org/rfc/rfc6376.html#section-3.3
@@ -219,7 +224,7 @@ in {
require = true;
};
rcpt = {
- directory = "'in-memory'";
+ directory = "'${directory}'";
catch-all = true;
subaddressing = true;
};
@@ -236,7 +241,7 @@ in {
};
auth = {
mechanisms = ["LOGIN" "PLAIN"];
- directory = "'in-memory'";
+ directory = "'${directory}'";
require = true;
must-match-sender = true;
errors = {
@@ -467,6 +472,14 @@ in {
# Perform “maintenance” every day at 3 am local time.
purge.frequency = "0 3 *";
};
+ "rocksdb-directory" = lib.mkIf (cfg.principals == null) {
+ type = "rocksdb";
+ path = "${cfg.dataDirectory}/storage/directory";
+ compression = "lz4";
+
+ # Perform “maintenance” every day at 1 am local time.
+ purge.frequency = "0 1 *";
+ };
"rocksdb-full-text-search" = {
type = "rocksdb";
path = "${cfg.dataDirectory}/storage/full-text-search";
@@ -505,7 +518,7 @@ in {
full-text.default-language = "en";
fts = "rocksdb-full-text-search";
- directory = "in-memory";
+ directory = "${directory}";
lookup = "redis";
@@ -516,9 +529,15 @@ in {
encryption.enable = false;
};
- directory."in-memory" = {
- type = "memory";
- inherit (cfg) principals;
+ directory = {
+ "in-memory" = lib.mkIf (cfg.principals != null) {
+ type = "memory";
+ inherit (cfg) principals;
+ };
+ "internal" = lib.mkIf (cfg.principals == null) {
+ type = "internal";
+ store = "rocksdb-directory";
+ };
};
certificate = {