enable stalwart-mail for contacts

This commit is contained in:
Noah Masur
2025-09-17 03:35:20 +00:00
parent 483833cdcb
commit 8b3ab57b34
3 changed files with 58 additions and 0 deletions

View File

@@ -114,6 +114,7 @@
bookmarks = "keep.${baseName}";
books = "books.${baseName}";
budget = "money.${baseName}";
contacts = "contacts.${baseName}";
content = "cloud.${baseName}";
download = "download.${baseName}";
files = "files.${baseName}";

View File

@@ -0,0 +1,56 @@
# Stalwart is a self-hosted email service, but in my case I want to use it as a
# vCard contacts database server and ignore the email component.
{ config, lib, ... }:
let
inherit (config.nmasur.settings) hostnames;
cfg = config.nmasur.presets.services.stalwart-mail;
in
{
options.nmasur.presets.services.stalwart-mail = {
enable = lib.mkEnableOption "Stalwart mail and contacts server";
port = lib.mkOption {
type = lib.types.port;
description = "Port to use for the localhost";
default = 7982;
};
};
config = lib.mkIf cfg.enable {
services.stalwart-mail = {
enable = true;
settings = {
server.listener.http = {
bind = [ "127.0.0.1:${builtins.toString cfg.port}" ];
protocol = "http";
};
authentication.fallback-admin = {
user = "admin";
secret = "$6$W/zXJP0xtZSUQqIe$DedCz9ncAn8mtfQVCg8Fzguuz.x8u1dfVU/d7wKyc6ujLuY4WCdtY0OeYwpv8huJfKAgBKE3go2MTrT99ID7I1";
};
};
};
# Configure Cloudflare DNS to point to this machine
services.cloudflare-dyndns.domains = [ hostnames.contacts ];
# Allow web traffic to Caddy
nmasur.presets.services.caddy.routes = [
{
match = [ { host = [ hostnames.contacts ]; } ];
handle = [
{
handler = "reverse_proxy";
upstreams = [
{ dial = "localhost:${builtins.toString cfg.port}"; }
];
}
];
}
];
};
}

View File

@@ -36,6 +36,7 @@ in
ntfy-sh.enable = lib.mkDefault true;
pgweb.enable = lib.mkDefault true;
postgresql.enable = lib.mkDefault true;
stalwart-mail.enable = lib.mkDefault true;
thelounge.enable = lib.mkDefault true;
uptime-kuma.enable = lib.mkDefault true;
vaultwarden.enable = lib.mkDefault true;