summary refs log tree commit diff stats
path: root/system/services/acme/default.nix
blob: a163e77620aae65d14cf4ce2246fde2912c79237 (plain) (blame)
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
{...}: {
  users.users.nginx.extraGroups = ["acme"];

  services.nginx = {
    enable = true;
    virtualHosts = {
      "acmechallenge.vhack.eu" = {
        serverAliases = ["*.vhack.eu"];
        locations."/.well-known/acme-challenge" = {
          root = "/var/lib/acme/.challenges";
        };
        locations."/" = {
          return = "301 https://$host$request_uri";
        };
      };
    };
  };

  security.acme = {
    acceptTerms = true;
    defaults.email = "admin@vhack.eu";
    certs = {
      "server1.vhack.eu" = {
        webroot = "/var/lib/acme/.challenges";
        group = "nginx";
        extraDomainNames = ["imap.vhack.eu" "smtp.vhack.eu"];
      };
    };
  };
}