summaryrefslogtreecommitdiff
path: root/host/software/server/mail.nix
blob: f7e498d50263991f0af8a77ab7b13b98cefc437c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ config, pkgs, ... }:

{
  imports = [
    (builtins.fetchTarball "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/v2.2.1/nixos-mailserver-v2.2.1.tar.gz")
  ];

  mailserver = {
    enable = true;
    fqdn = "mx.kummerlaender.eu";
    domains = [ "kummerlaender.eu" ];

    loginAccounts = import ./mailusers.nix;

    # Enable LetsEncrypt
    certificateScheme = 3;

    enableImap = true;
    enableImapSsl = true;
  };

  systemd.services.fetchmail = {
    enable = true;
    after  = [ "dovecot2.service" ];
    wantedBy = [ "dovecot2.service" ];
    serviceConfig = {
      User = "virtualMail";
      ExecStart = ''
        ${pkgs.fetchmail}/bin/fetchmail --fetchmailrc /var/vmail/fetchmailrc \
                                        --mda "${pkgs.dovecot}/libexec/dovecot/deliver -d adrian@kummerlaender.eu"
      '';
    };
  };
}