From afcaf310b923d55e41d6120d1ccaade136e66691 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Mon, 4 Apr 2022 17:21:50 +0200 Subject: flora: add a simple mailserver setup mostly to get a working sendmail and also play around with stuff --- flake.lock | 100 ++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 2 + flora/configuration.nix | 1 + flora/services/mail.nix | 26 +++++++++++++ 4 files changed, 129 insertions(+) create mode 100644 flora/services/mail.nix diff --git a/flake.lock b/flake.lock index 79a62e4..080cf0e 100644 --- a/flake.lock +++ b/flake.lock @@ -12,6 +12,22 @@ "type": "path" } }, + "blobs": { + "flake": false, + "locked": { + "lastModified": 1604995301, + "narHash": "sha256-wcLzgLec6SGJA8fx1OEN1yV/Py5b+U5iyYpksUY/yLw=", + "owner": "simple-nixos-mailserver", + "repo": "blobs", + "rev": "2cccdf1ca48316f2cfd1c9a0017e8de5a7156265", + "type": "gitlab" + }, + "original": { + "owner": "simple-nixos-mailserver", + "repo": "blobs", + "type": "gitlab" + } + }, "blog": { "flake": false, "locked": { @@ -131,6 +147,36 @@ "type": "github" } }, + "nixpkgs-21_05": { + "locked": { + "lastModified": 1625692408, + "narHash": "sha256-e9L3TLLDVIJpMnHtiNHJE62oOh6emRtSZ244bgYJUZs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c06613c25df3fe1dd26243847a3c105cf6770627", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-21.05", + "type": "indirect" + } + }, + "nixpkgs-21_11": { + "locked": { + "lastModified": 1638371214, + "narHash": "sha256-0kE6KhgH7n0vyuX4aUoGsGIQOqjIx2fJavpCWtn73rc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a640d8394f34714578f3e6335fc767d0755d78f9", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-21.11", + "type": "indirect" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1646470760, @@ -147,6 +193,21 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1626852498, + "narHash": "sha256-lOXUJvi0FJUXHTVSiC5qsMRtEUgqM4mGZpMESLuGhmo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "16105403bdd843540cbef9c63fc0f16c1c6eaa70", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, "playground": { "flake": false, "locked": { @@ -175,6 +236,7 @@ "nixpkgs-unstable": "nixpkgs-unstable", "playground": "playground", "sfz": "sfz", + "simple-nixos-mailserver": "simple-nixos-mailserver", "tracktrain": "tracktrain", "uplcg": "uplcg", "walint": "walint" @@ -196,6 +258,29 @@ "type": "github" } }, + "simple-nixos-mailserver": { + "inputs": { + "blobs": "blobs", + "nixpkgs": "nixpkgs_2", + "nixpkgs-21_05": "nixpkgs-21_05", + "nixpkgs-21_11": "nixpkgs-21_11", + "utils": "utils_2" + }, + "locked": { + "lastModified": 1638911354, + "narHash": "sha256-hNhzLOp+dApEY15vwLAQZu+sjEQbJcOXCaSfAT6lpsQ=", + "owner": "simple-nixos-mailserver", + "repo": "nixos-mailserver", + "rev": "6e3a7b2ea6f0d68b82027b988aa25d3423787303", + "type": "gitlab" + }, + "original": { + "owner": "simple-nixos-mailserver", + "ref": "nixos-21.11", + "repo": "nixos-mailserver", + "type": "gitlab" + } + }, "tracktrain": { "flake": false, "locked": { @@ -245,6 +330,21 @@ "type": "github" } }, + "utils_2": { + "locked": { + "lastModified": 1605370193, + "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5021eac20303a61fafe17224c087f5519baed54d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "walint": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index a97d423..148c31d 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,8 @@ naersk.inputs.nixpkgs.follows = "nixpkgs"; deploy-rs.url = "github:serokell/deploy-rs"; deploy-rs.inputs.nixpkgs.follows = "nixpkgs"; + simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-21.11"; + # simple-nixos-mailserver.follows = "nixpkgs"; uplcg.url = "git+https://stuebinm.eu/git/uplcg?ref=main"; uplcg.flake = false; diff --git a/flora/configuration.nix b/flora/configuration.nix index ada156e..fde327b 100644 --- a/flora/configuration.nix +++ b/flora/configuration.nix @@ -13,6 +13,7 @@ ./services/dockerhub.nix ./services/blog.nix ./services/znc.nix + ./services/mail.nix ]; # Use the GRUB 2 boot loader. diff --git a/flora/services/mail.nix b/flora/services/mail.nix new file mode 100644 index 0000000..d41f0e8 --- /dev/null +++ b/flora/services/mail.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + imports = [ inputs.simple-nixos-mailserver.nixosModule ]; + + + + mailserver = { + enable = true; + fqdn = "mail.stuebinm.eu"; + domains = [ "stuebinm.eu" ]; + + # A list of all login accounts. To create the password hashes, use + # nix run nixpkgs.apacheHttpd -c htpasswd -nbB "" "super secret password" | cut -d: -f2 + loginAccounts = { + "hello@stuebinm.eu" = { + hashedPasswordFile = "/var/mailstate/hello-password"; + aliases = ["postmaster@stuebinm.eu" "abuse@stuebinm.eu"]; + }; + }; + + # Use Let's Encrypt certificates. Note that this needs to set up a stripped + # down nginx and opens port 80. + certificateScheme = 3; + }; +} -- cgit v1.2.3