From 39e630f12a6c41fdb2370ce947cfe6d7647fac4a Mon Sep 17 00:00:00 2001 From: Lgmrszd Date: Thu, 16 May 2024 01:07:17 +0300 Subject: [PATCH] vps1: enable mailserver --- hosts/vps1/configuration.nix | 3 +++ hosts/vps1/data/services.toml | 2 ++ hosts/vps1/services/mailserver.nix | 37 ++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 hosts/vps1/services/mailserver.nix diff --git a/hosts/vps1/configuration.nix b/hosts/vps1/configuration.nix index 9fe576a..b515b50 100644 --- a/hosts/vps1/configuration.nix +++ b/hosts/vps1/configuration.nix @@ -1,6 +1,7 @@ { pkgs, config, data, ... }: let inherit (data.host) rootDomain; + mailDomain = data.services.mailserver.domain; gtnhDomain = "gtnh.${rootDomain}"; discDomain = "discourse.testdrive.${rootDomain}"; akkoDomain = "akko429164.testdrive.${rootDomain}"; @@ -12,6 +13,7 @@ in ./hardware-configuration.nix ./services/postgres.nix ./services/git.nix + ./services/mailserver.nix ./akkotest.nix (fetchTarball { url = "https://github.com/cariandrum22/nixos-vscode-server/tarball/support-for-new-dir-structure-of-vscode-server"; sha256 = "1sp4h0nb7dh7mcm8vdflihv76yz8azf5zifkcbxhq7xz48c8k5pd"; }) @@ -123,6 +125,7 @@ in dnsProvider = "porkbun"; environmentFile = config.sops.secrets.porkbun.path; extraDomainNames = [ + mailDomain "*.${rootDomain}" "*.testdrive.${rootDomain}" # gtnhDomain diff --git a/hosts/vps1/data/services.toml b/hosts/vps1/data/services.toml index 9046bce..f0f894d 100644 --- a/hosts/vps1/data/services.toml +++ b/hosts/vps1/data/services.toml @@ -2,3 +2,5 @@ subdomain = "git" sshPort = 22631 +[mailserver] +subdomain = "mail" diff --git a/hosts/vps1/services/mailserver.nix b/hosts/vps1/services/mailserver.nix new file mode 100644 index 0000000..99709ad --- /dev/null +++ b/hosts/vps1/services/mailserver.nix @@ -0,0 +1,37 @@ +{ lib, config, data, ...}: +let + inherit (data.host) rootDomain; + inherit (data.services.mailserver) domain; + gitDomain = data.services.git.domain; +in +{ + mailserver = { + enable = true; + fqdn = domain; + domains = [ + rootDomain + domain + gitDomain + ]; + certificateScheme = "acme"; + + enableManageSieve = true; + indexDir = "/var/lib/dovecot/indices"; + dkimKeyBits = 4096; + + loginAccounts = { + "lgm@${rootDomain}" = { + aliases = [ + "lgmrszd@${rootDomain}" + "postmaster@${rootDomain}" + "abuse@${rootDomain}" + ]; + }; + "forgejo@${rootDomain}" = { + aliases = [ + "@${gitDomain}" + ]; + }; + }; + }; +}