summaryrefslogtreecommitdiff
path: root/host/software/server/mail.nix
blob: 37c007b05064b39bf037e89d47fa4062da8f8a9c (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
35
36
37
38
{ config, pkgs, ... }:

{
  imports = let
    release = "nixos-21.05";
  in [
    (builtins.fetchTarball {
      url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/${release}/nixos-mailserver-${release}.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"
      '';
    };
  };
}