2026-07-29 18:21:26 -04:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
|
|
{
|
2026-09-25 14:32:09 -04:00
|
|
|
services.maddy = {
|
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
|
|
ensureAccounts = [ "lilac@grasswren.net" ];
|
|
|
|
|
ensureCredentials."lilac@grasswren.net".passwordFile = config.sops.secrets.mxpass.path;
|
|
|
|
|
|
2026-09-30 00:51:44 -04:00
|
|
|
secrets = [ config.sops.secrets.cftoken.path config.sops.secrets.s2guser.path config.sops.secrets.s2gpass.path ];
|
2026-09-25 14:32:09 -04:00
|
|
|
|
|
|
|
|
tls = {
|
|
|
|
|
loader = "acme";
|
|
|
|
|
extraConfig = ''
|
2026-09-26 16:59:53 -04:00
|
|
|
hostname $(hostname)
|
2026-09-25 14:32:09 -04:00
|
|
|
email lilac@grasswren.net
|
|
|
|
|
agreed
|
|
|
|
|
challenge dns-01
|
|
|
|
|
dns cloudflare {
|
|
|
|
|
api_token "{env:CFTOKEN}"
|
|
|
|
|
}
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2026-09-26 16:59:53 -04:00
|
|
|
primaryDomain = "grasswren.net";
|
|
|
|
|
hostname = "grasswren.net";
|
2026-09-25 14:32:09 -04:00
|
|
|
|
2026-09-26 16:59:53 -04:00
|
|
|
config = ''
|
|
|
|
|
auth.pass_table local_authdb {
|
|
|
|
|
table sql_table {
|
|
|
|
|
driver sqlite3
|
|
|
|
|
table_name passwords
|
|
|
|
|
dsn auth.db
|
|
|
|
|
}
|
2026-09-25 14:32:09 -04:00
|
|
|
}
|
|
|
|
|
|
2026-09-26 16:59:53 -04:00
|
|
|
storage.imapsql local_mailboxes {
|
2026-09-25 14:32:09 -04:00
|
|
|
driver sqlite3
|
|
|
|
|
dsn mailbox.db
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-30 00:51:44 -04:00
|
|
|
target.smtp relay {
|
|
|
|
|
hostname $(hostname)
|
|
|
|
|
starttls yes
|
|
|
|
|
auth plain "{env:S2GUSER}" "{env:S2GPASS}"
|
|
|
|
|
targets tcp://mail.smtp2go.com:587
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-25 14:32:09 -04:00
|
|
|
smtp tcp://0.0.0.0:25 {
|
|
|
|
|
default_source {
|
|
|
|
|
destination grasswren.net {
|
|
|
|
|
modify {
|
|
|
|
|
replace_rcpt regexp ".*" "lilac@grasswren.net"
|
|
|
|
|
}
|
2026-09-26 16:59:53 -04:00
|
|
|
deliver_to &local_mailboxes
|
2026-09-25 14:32:09 -04:00
|
|
|
}
|
|
|
|
|
default_destination {
|
|
|
|
|
reject 550 5.1.1 "No Such User"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-30 00:51:44 -04:00
|
|
|
submission tls://0.0.0.0:587 {
|
|
|
|
|
auth &local_authdb
|
|
|
|
|
|
|
|
|
|
default_source {
|
|
|
|
|
default_destination {
|
|
|
|
|
deliver_to &relay
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-25 14:32:09 -04:00
|
|
|
imap tls://0.0.0.0:993 {
|
2026-09-26 16:59:53 -04:00
|
|
|
auth &local_authdb
|
|
|
|
|
storage &local_mailboxes
|
2026-09-25 14:32:09 -04:00
|
|
|
}
|
|
|
|
|
'';
|
|
|
|
|
};
|
2026-07-29 18:21:26 -04:00
|
|
|
}
|