From f7c3f6e27960da9d4cb15e0b52ab431b65174f19 Mon Sep 17 00:00:00 2001 From: Jimbo Date: Tue, 22 Oct 2024 20:43:32 -0400 Subject: [PATCH] Setup mail service to be hosted on Bomberman --- hosts/bomberman/system/default.nix | 6 +-- hosts/cyberspark/system/default.nix | 1 + .../services/server/mailserver/default.nix | 46 +---------------- .../server/mailserver/simplenix/default.nix | 49 +++++++++++++++++++ .../{ => simplenix}/nginx/default.nix | 0 5 files changed, 54 insertions(+), 48 deletions(-) create mode 100644 modules/system/services/server/mailserver/simplenix/default.nix rename modules/system/services/server/mailserver/{ => simplenix}/nginx/default.nix (100%) diff --git a/hosts/bomberman/system/default.nix b/hosts/bomberman/system/default.nix index 20bdfc2..341dd8b 100644 --- a/hosts/bomberman/system/default.nix +++ b/hosts/bomberman/system/default.nix @@ -1,4 +1,4 @@ -{ mailserver, config, ... }: +{ config, ... }: { imports = [ ./hardware @@ -14,13 +14,11 @@ ../../../modules/system/programs/git ../../../modules/system/programs/security ../../../modules/system/services/common + ../../../modules/system/services/server/mailserver/simplenix # Misc ../../../overlays ../../../variables - - # Imports - mailserver.nixosModule ]; networking.hostName = "bomberman"; diff --git a/hosts/cyberspark/system/default.nix b/hosts/cyberspark/system/default.nix index 5979d3b..ac16b93 100644 --- a/hosts/cyberspark/system/default.nix +++ b/hosts/cyberspark/system/default.nix @@ -15,6 +15,7 @@ ../../../modules/system/programs/security ../../../modules/system/services/common ../../../modules/system/services/server + ../../../modules/system/services/server/mailserver/roundcube # Misc ../../../overlays diff --git a/modules/system/services/server/mailserver/default.nix b/modules/system/services/server/mailserver/default.nix index 315b2a0..0c37f91 100644 --- a/modules/system/services/server/mailserver/default.nix +++ b/modules/system/services/server/mailserver/default.nix @@ -1,49 +1,7 @@ -{ pkgs, config, ... }: +{ ... }: { imports = [ - ./nginx + ./simplenix ./roundcube ]; - - mailserver = rec { - enable = true; - openFirewall = false; - domains = [ "${config.secrets.jimDomain}" ]; - fqdn = "mx.${config.secrets.jimDomain}"; - certificateScheme = "acme-nginx"; - localDnsResolver = false; - redis.port = 1515; - - # Dmarc info - dmarcReporting = { - enable = true; - domain = "${config.secrets.jimDomain}"; - localpart = "noreply"; - organizationName = "Jimbo's Files"; - }; - - # A list of accounts, passwords generated with nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt' - loginAccounts = { - "noreply@${config.secrets.jimDomain}" = { - hashedPasswordFile = pkgs.writeText "noreply" config.secrets.noreplyMailHash; - sendOnly = true; - }; - "jimbo@${config.secrets.jimDomain}" = { - hashedPasswordFile = pkgs.writeText "jimbo" config.secrets.jimboMailHash; - aliases = [ "james@${config.secrets.jimDomain}" "contact@${config.secrets.jimDomain}" ]; - }; - "lunamoonlight@${config.secrets.jimDomain}" = { - hashedPasswordFile = pkgs.writeText "luna" config.secrets.lunaMailHash; - }; - "freecorn1854@${config.secrets.jimDomain}" = { - hashedPasswordFile = pkgs.writeText "freecorn" config.secrets.freecornMailHash; - }; - "tinyattack09@${config.secrets.jimDomain}" = { - hashedPasswordFile = pkgs.writeText "tiny" config.secrets.tinyMailHash; - }; - }; - }; - - # Assign the correct port - services.redis.servers.rspamd.port = 1515; } diff --git a/modules/system/services/server/mailserver/simplenix/default.nix b/modules/system/services/server/mailserver/simplenix/default.nix new file mode 100644 index 0000000..b9e5d60 --- /dev/null +++ b/modules/system/services/server/mailserver/simplenix/default.nix @@ -0,0 +1,49 @@ +{ mailserver, pkgs, config, ... }: +{ + imports = [ + ./nginx + mailserver.nixosModule + ]; + + mailserver = rec { + enable = true; + openFirewall = false; + domains = [ "${config.secrets.jimDomain}" ]; + fqdn = "mx.${config.secrets.jimDomain}"; + certificateScheme = "acme-nginx"; + localDnsResolver = false; + redis.port = 1515; + + # Dmarc info + dmarcReporting = { + enable = true; + domain = "${config.secrets.jimDomain}"; + localpart = "noreply"; + organizationName = "Jimbo's Files"; + }; + + # A list of accounts, passwords generated with nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt' + loginAccounts = { + "noreply@${config.secrets.jimDomain}" = { + hashedPasswordFile = pkgs.writeText "noreply" config.secrets.noreplyMailHash; + sendOnly = true; + }; + "jimbo@${config.secrets.jimDomain}" = { + hashedPasswordFile = pkgs.writeText "jimbo" config.secrets.jimboMailHash; + aliases = [ "james@${config.secrets.jimDomain}" "contact@${config.secrets.jimDomain}" ]; + }; + "lunamoonlight@${config.secrets.jimDomain}" = { + hashedPasswordFile = pkgs.writeText "luna" config.secrets.lunaMailHash; + }; + "freecorn1854@${config.secrets.jimDomain}" = { + hashedPasswordFile = pkgs.writeText "freecorn" config.secrets.freecornMailHash; + }; + "tinyattack09@${config.secrets.jimDomain}" = { + hashedPasswordFile = pkgs.writeText "tiny" config.secrets.tinyMailHash; + }; + }; + }; + + # Assign the correct port + services.redis.servers.rspamd.port = 1515; +} diff --git a/modules/system/services/server/mailserver/nginx/default.nix b/modules/system/services/server/mailserver/simplenix/nginx/default.nix similarity index 100% rename from modules/system/services/server/mailserver/nginx/default.nix rename to modules/system/services/server/mailserver/simplenix/nginx/default.nix