synix/docs/modules/nixos/mailserver.md
sid 95a533c876
All checks were successful
Deploy docs / build-and-deploy (push) Successful in 3s
initial commit
2026-02-23 20:34:35 +01:00

1.3 KiB

Mail

A simple NixOS mailserver.

View the synix NixOS module on Forgejo.

References

Setup

Follow the setup guide.

Sops

Provide every user's hashed password to your host's secrets.yaml:

Replace abc123 with your actual secrets

mailserver:
    accounts:
        user1: abc123
        user2: abc123
        # ...

Generate hashed passwords with:

nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt'

Config

flake.nix

inputs = {
  nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
  nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs";
};

Host configuration:

imports = [ inputs.synix.nixosModules.mailserver ]

mailserver = {
  enable = true;
  accounts = {
    admin = {
      aliases = [ "postmaster" ];
    };
    alice = { };
  };
};

You may need to set mailserver.stateVersion. At the time of writing, you need to set it to 3, but you should check the mailserver docs yourself.