Self-hosted email solution using NixOS.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 6 commits ahead, 1 commit behind valeriangalliat:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
default.nix
opensmtpd-service.diff
opensmtpd.diff
opensmtpd.nix
proc_path.diff

README.md

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

  1. run sa-update
  2. add /var/lib/dkim/*/default.txt TXT records to your domain for DKIM
  3. open ports 587 and 993 (I removed these here because I run them on a VPN)
  4. apply opensmtpd-service.diff to your nixpkgs if needed