Back to services

Simple NixOS Mailserver

Complete mailserver solution leveraging the Nix Ecosystem.

View alternatives to Simple NixOS Mailserver
Suggest edit
Open source
Self-hostable
GPL-3.0
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Note: Fetching the official site (the GitLab project page) failed. The content below is based on prior knowledge of the project, so please refer to the official repository and documentation for the exact options and supported versions.

Introduction

Simple NixOS Mailserver (SNM for short) is a community-maintained open-source project hosted on GitLab. It provides a complete mail server solution in the form of a NixOS module. Its goal is to let people set up and maintain their own email service with simple, declarative configuration, without having to configure and wire together multiple mail components by hand.

Key Features

  • SMTP sending and receiving: Based on Postfix, with support for SMTP submission and TLS encryption.
  • IMAP / POP3 access: Based on Dovecot, so mail clients can sync mailboxes normally.
  • Anti-spam: Integrates Rspamd to filter spam.
  • Sender authentication: Supports DKIM signing, and works with DNS records such as SPF and DMARC to improve deliverability.
  • Automatic certificates: Can obtain and renew TLS certificates automatically through Let's Encrypt (ACME).
  • Mail filtering rules: Supports Sieve scripts and ManageSieve, so users can define their own server-side filtering rules.
  • Multiple domains and account management: You can declare multiple domains, mailbox accounts, aliases and catch-all addresses in the configuration, and set quotas for accounts.
  • Full-text search: Full-text mail search can be enabled.

Target Users and Use Cases

  • Individuals and small teams who already use NixOS and want to self-host their email.
  • Users who want to control their own email data and not depend on large mail providers.
  • Providing mailboxes for a personal domain, a household or a small organization.
  • Administrators who want to put their mail server configuration under version control and achieve reproducible deployments.

Core Advantages

  • Declarative and reproducible: The entire mail service is written in Nix configuration, which makes migration, rebuilding and rollback easy.
  • Works out of the box: The mainstream mail components are already integrated and security-related defaults are preconfigured, so it requires significantly less configuration than a manual setup.
  • Easy to maintain: It follows NixOS release branches, so the mail service is upgraded along with the system.

Deployment

  1. Prepare a NixOS server with a public IP address, and make sure port 25 can communicate normally.
  2. Import the SNM module in your NixOS configuration. You can do this with a Flake, or with fetchTarball using the branch that matches your system version.
  3. Enable mailserver.enable in your configuration and fill in fqdn, domains and loginAccounts. Account passwords are entered as hashes, which you can generate with mkpasswd.
  4. Configure how certificates are obtained, for example automatically through ACME.
  5. Run nixos-rebuild switch to apply the configuration.
  6. Add MX, SPF, DKIM and DMARC records in DNS, and set up reverse DNS (PTR).

Technical Requirements

  • A server (VPS or physical machine) running NixOS.
  • A domain whose DNS you can manage yourself.
  • A server IP with a good reputation, the ability to set a PTR record, and a provider that does not block port 25.

Notable Points

  • It is released under an open-source license (usually listed as GPL-3.0).
  • The project provides online documentation covering configuration options, backup methods and frequently asked questions.
  • Self-hosting email requires ongoing attention to deliverability, IP reputation and security updates, so it is best suited to users with some operations experience.