NixOS Mailz
Self-hosted email solution using NixOS.
Proudly inspired by Docker Mailz.
Overview
NixOS Mailz is a NixOS module to preconfigure OpenSMTPD, SpamAssassin and Dovecot in perfect harmony with the bare minimum configuration options.
It's either meant to be directly included in your NixOS configuration or just to show an example of a working configuration of OpenSMTPD, SpamAssassin and Dovecot on NixOS, from which you can find inspiration.
Usage
Encrypt your users' passwords
nix-shell -p opensmtpd --command 'smtpctl encrypt'For each line you'll enter, the encrypted equivalent will be printed.
NixOS configuration
{ config, pkgs, ... }:
{
imports = [
# ...
/path/to/mailz
# ...
];
services.mailz = {
domain = "example.com";
users = {
foo = {
password = "encrypted";
aliases = [ "postmaster" ];
};
};
};
}Manual actions
- run
sa-update - add
/var/lib/dkim/*/default.txtTXT records to your domain for DKIM - open ports
587and993(I removed these here because I run them on a VPN) - apply
opensmtpd-service.diffto yournixpkgsif needed