summary refs log tree commit diff stats
path: root/system/services/taskserver/default.nix
blob: afbd09ca2ee4149714f707a4a52763d01ec864cf (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{...}: let
  taskStore = "/var/lib/taskserver";
in {
  services.taskserver = {
    enable = true;
    config = {
      server = {
        cert = "${taskStore}/fullchain.pem";
        key = "${taskStore}/privkey.pem";
      };
    };
    pki = {
      auto = {
        expiration = {
          server = 365;
          crl = 365;
          client = 365;
          ca = 365;
        };
        bits = 4096;
      };
      manual = {
        ca.cert = builtins.toPath "${taskStore}/cert.pem";
        server = {
          cert = builtins.toPath "${taskStore}/fullchain.pem";
          key = builtins.toPath "${taskStore}/privkey.pem";
        };
      };
    };
    organisations = import ./organisations.nix;
    trust = "strict";
    openFirewall = true;
    fqdn = "taskserver.vhack.eu";
    listenHost = "taskserver.vhack.eu";
  };
  security.acme.certs.taskserver = {
    domain = "taskserver.vhack.eu";
    postRun =
      /*
      bash
      */
      ''
        set -x
        rm "${taskStore}/key.pem"
        rm "${taskStore}/fullchain.pem"
        rm "${taskStore}/cert.pem"

        cp key.pem "${taskStore}";
        cp fullchain.pem "${taskStore}";
        cp cert.pem "${taskStore}";

        chown taskd:taskd "${taskStore}/key.pem"
        chown taskd:taskd "${taskStore}/fullchain.pem"
        chown taskd:taskd "${taskStore}/cert.pem"
      '';
  };
}