grimm-nix-server/modules/email.nix

48 lines
1.4 KiB
Nix
Raw Normal View History

{ ... }:
let
root_host = "grimmauld.de";
mail_host = "mail.${root_host}";
in {
security.acme.certs."${root_host}".extraDomainNames = [ mail_host ];
2024-02-03 11:51:15 +01:00
# services.dovecot2.sieve.extensions = [ "fileinto" ]; # sives break without this for some reason
mailserver = {
enable = true;
fqdn = mail_host;
domains = [ root_host ];
# A list of all login accounts. To create the password hashes, use
# nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt'
loginAccounts = {
"contact@${root_host}" = {
hashedPasswordFile = ./mailpass/contact;
aliases = ["kontakt@${root_host}"];
};
"admin@${root_host}" = {
hashedPasswordFile = ./mailpass/admin;
};
2024-02-03 11:51:15 +01:00
"grimmauld@${root_host}" = {
hashedPasswordFile = ./mailpass/grimmauld;
};
};
# Use Let's Encrypt certificates. Note that this needs to set up a stripped
# down nginx and opens port 80.
certificateScheme = "manual";
certificateFile = "/var/lib/acme/${root_host}/fullchain.pem";
keyFile = "/var/lib/acme/${root_host}/key.pem";
};
services.nginx = {
enable = true;
virtualHosts."${mail_host}" = { # you should NOT be here from a browser :P
serverName = mail_host;
forceSSL = true;
useACMEHost = root_host;
locations."/" = {
return = "307 https://${root_host}";
};
};
};
}