From 08d66a405348b312acdd386a6ee6d072c14795d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Wed, 27 Mar 2024 02:28:28 -0300 Subject: [PATCH] ghost: add mail server --- flake.nix | 5 +++++ hosts/ghost/default.nix | 1 + hosts/ghost/email.nix | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 hosts/ghost/email.nix diff --git a/flake.nix b/flake.nix index 7951467..8638820 100644 --- a/flake.nix +++ b/flake.nix @@ -32,6 +32,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + nixos-mailserver = { + url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-23.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + dzgui-nix = { url = "github:lelgenio/dzgui-nix"; }; diff --git a/hosts/ghost/default.nix b/hosts/ghost/default.nix index 040a093..04196b3 100644 --- a/hosts/ghost/default.nix +++ b/hosts/ghost/default.nix @@ -11,6 +11,7 @@ ./users.nix ./writefreely.nix ./renawiki.nix + ./email.nix ]; # Use more aggressive compression then the default. diff --git a/hosts/ghost/email.nix b/hosts/ghost/email.nix new file mode 100644 index 0000000..39afdb6 --- /dev/null +++ b/hosts/ghost/email.nix @@ -0,0 +1,34 @@ +{ pkgs, inputs, ... }: { + networking.hostName = "lelgenio.xyz"; + + imports = [ + inputs.nixos-mailserver.nixosModules.mailserver + ]; + + mailserver = { + enable = true; + fqdn = "mail.lelgenio.xyz"; + domains = [ "lelgenio.xyz" ]; + certificateScheme = "acme-nginx"; + loginAccounts = { + "lelgenio@lelgenio.xyz" = { + hashedPassword = "$2y$05$z5s7QCXcs5uTFsfyYpwNJeWzb3RmzgWxNgcPCr0zjSytkLFF/qZmS"; + aliases = [ "postmaster@lelgenio.xyz" ]; + }; + }; + }; + + # Webmail + services.roundcube = rec { + enable = true; + package = pkgs.roundcube.withPlugins (p: [ p.carddav ]); + hostName = "mail.lelgenio.xyz"; + extraConfig = '' + $config['smtp_host'] = "tls://${hostName}:587"; + $config['smtp_user'] = "%u"; + $config['smtp_pass'] = "%p"; + $config['plugins'] = [ "carddav" ]; + ''; + }; + +}