111 lines
2.9 KiB
Nix
111 lines
2.9 KiB
Nix
{ inputs, ... }:
|
|
{
|
|
flake-file.inputs.nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
|
|
|
|
den.aspects.services.mailserver = let port = 8088; in {
|
|
tunnel = [
|
|
{ subdomain = "mail"; inherit port; }
|
|
{ subdomain = "email"; inherit port; }
|
|
];
|
|
|
|
nixos = { host, config, ... }: let user = host.owner; home = config.users.users.${user}.home; inherit (host) domain; in {
|
|
imports = [ inputs.nixos-mailserver.nixosModules.default ];
|
|
|
|
security.acme = {
|
|
acceptTerms = true;
|
|
defaults.email = "security@${domain}";
|
|
|
|
certs."mx.${domain}" = {
|
|
listenHTTP = ":1360";
|
|
};
|
|
};
|
|
|
|
mailserver = {
|
|
enable = true;
|
|
|
|
stateVersion = 4;
|
|
|
|
fqdn = "mx.${domain}";
|
|
domains = [ "${domain}" ];
|
|
|
|
x509.useACMEHost = "mx.${domain}";
|
|
|
|
fullTextSearch = {
|
|
enable = true;
|
|
autoIndex = true;
|
|
fallback = false;
|
|
};
|
|
|
|
accounts = {
|
|
"${user}@${domain}" = {
|
|
hashedPasswordFile = "${home}/mailserver/bug.passwd";
|
|
aliases = [
|
|
"admin@${domain}"
|
|
"security@${domain}"
|
|
"google@${domain}"
|
|
"apple@${domain}"
|
|
"roblox@${domain}"
|
|
"twitch@${domain}"
|
|
"discord@${domain}"
|
|
"github@${domain}"
|
|
"matrix@${domain}"
|
|
"git@${domain}"
|
|
"contact@${domain}"
|
|
"claude@${domain}"
|
|
"rumble@${domain}"
|
|
"bambu@${domain}"
|
|
"soulframe@${domain}"
|
|
"vortex@${domain}"
|
|
"codex@${domain}"
|
|
"tailscale@${domain}"
|
|
"firefox@${domain}"
|
|
"keldurn@${domain}"
|
|
"brax@${domain}"
|
|
];
|
|
};
|
|
|
|
"pare@${domain}" = {
|
|
hashedPasswordFile = "${home}/mailserver/pare.passwd";
|
|
};
|
|
|
|
"poop@${domain}" = {
|
|
hashedPasswordFile = "${home}/mailserver/pare.passwd";
|
|
};
|
|
};
|
|
};
|
|
|
|
services.roundcube = {
|
|
enable = true;
|
|
hostName = "mail.${domain}";
|
|
extraConfig = ''
|
|
$config['imap_host'] = 'ssl://localhost:993';
|
|
$config['imap_conn_options'] = [
|
|
'ssl' => ['verify_peer' => false, 'verify_peer_name' => false]
|
|
];
|
|
$config['smtp_host'] = 'ssl://localhost:465';
|
|
$config['smtp_conn_options'] = [
|
|
'ssl' => ['verify_peer' => false, 'verify_peer_name' => false]
|
|
];
|
|
$config['smtp_user'] = "%u";
|
|
$config['smtp_pass'] = "%p";
|
|
$config['username_domain'] = '${domain}';
|
|
'';
|
|
};
|
|
|
|
services.nginx.enable = true;
|
|
|
|
services.nginx.virtualHosts."mail.${domain}" = {
|
|
forceSSL = false;
|
|
enableACME = false;
|
|
|
|
listen = [
|
|
{
|
|
addr = "0.0.0.0";
|
|
port = port;
|
|
}
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|