A simple NixOS mailserver.
View the nix-core NixOS module on GitHub.
References
Setup
Follow the setup guide.
Config
flake.nix
inputs = {
nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs";
};
Host configuration:
imports = [ inputs.core.nixosModules.mailserver ]
mailserver = {
enable = true;
loginAccounts = {
"ADMIN@${config.networking.domain}" = {
# nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt'
hashedPasswordFile = config.sops.secrets."mailserver/accounts/ADMIN".path;
aliases = [ "postmaster@${config.networking.domain}" ];
};
};
};
sops.secrets."mailserver/accounts/ADMIN" = { };
Replace
ADMIN
with an existing administrator account.
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.