Skip to content

Commit

Permalink
stalwart-mail: fix default configuration and test
Browse files Browse the repository at this point in the history
  • Loading branch information
ThyMYthOS committed Feb 13, 2024
1 parent cf1efc0 commit cd8aad9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
13 changes: 9 additions & 4 deletions nixos/modules/services/mail/stalwart-mail.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ in {
global.tracing.level = mkDefault "info";
queue.path = mkDefault "${dataDir}/queue";
report.path = mkDefault "${dataDir}/reports";
store.db.type = mkDefault "sqlite";
store.db.path = mkDefault "${dataDir}/data/index.sqlite3";
store.blob.type = mkDefault "local";
store.blob.local.path = mkDefault "${dataDir}/data/blobs";
store.blob.type = mkDefault "fs";
store.blob.path = mkDefault "${dataDir}/data/blobs";
storage.data = mkDefault "db";
storage.fts = mkDefault "db";
storage.blob = mkDefault "blob";
resolver.type = mkDefault "system";
resolver.public-suffix = mkDefault ["https://publicsuffix.org/list/public_suffix_list.dat"];
};

systemd.services.stalwart-mail = {
Expand All @@ -57,8 +62,8 @@ in {
KillSignal = "SIGINT";
Restart = "on-failure";
RestartSec = 5;
StandardOutput = "syslog";
StandardError = "syslog";
StandardOutput = "journal";
StandardError = "journal";
SyslogIdentifier = "stalwart-mail";

DynamicUser = true;
Expand Down
11 changes: 7 additions & 4 deletions nixos/tests/stalwart-mail.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,22 @@ in import ./make-test-python.nix ({ lib, ... }: {

session.auth.mechanisms = [ "PLAIN" ];
session.auth.directory = "in-memory";
jmap.directory = "in-memory"; # shared with imap
storage.directory = "in-memory"; # shared with imap

session.rcpt.directory = "in-memory";
queue.outbound.next-hop = [ "local" ];

directory."in-memory" = {
type = "memory";
users = [
principals = [
{
type = "individual";
name = "alice";
secret = "foobar";
email = [ "alice@${domain}" ];
}
{
type = "individual";
name = "bob";
secret = "foobar";
email = [ "bob@${domain}" ];
Expand Down Expand Up @@ -90,8 +92,9 @@ in import ./make-test-python.nix ({ lib, ... }: {
with IMAP4('localhost') as imap:
imap.starttls()
imap.login('bob', 'foobar')
imap.select('"All Mail"')
status, [caps] = imap.login('bob', 'foobar')
assert status == 'OK'
imap.select()
status, [ref] = imap.search(None, 'ALL')
assert status == 'OK'
[msgId] = ref.split()
Expand Down

0 comments on commit cd8aad9

Please sign in to comment.