summaryrefslogtreecommitdiffstats
path: root/lass/2configs/websites/lassulus.nix
blob: 04c19fad0c5c40ff37b7a84c8ddd794c55875940 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{ config, pkgs, lib, ... }:

with lib;
let
  inherit (import <stockholm/krebs/4lib> { config = {}; inherit lib; })
    genid
  ;

in {
  imports = [
    ../git.nix
  ];

  security.acme = {
    certs."lassul.us" = {
      email = "lass@lassul.us";
      webroot = "/var/lib/acme/challenges/lassul.us";
      plugins = [
        "account_key.json"
        "key.pem"
        "fullchain.pem"
        "full.pem"
      ];
      allowKeysForGroup = true;
      group = "lasscert";
    };
    certs."cgit.lassul.us" = {
      email = "lassulus@gmail.com";
      webroot = "/var/lib/acme/challenges/cgit.lassul.us";
      plugins = [
        "account_key.json"
        "key.pem"
        "fullchain.pem"
      ];
      group = "nginx";
      allowKeysForGroup = true;
    };
  };

  users.groups.lasscert.members = [
    "dovecot2"
    "ejabberd"
    "exim"
    "nginx"
  ];

  krebs.nginx.servers."lassul.us" = {
    server-names = [ "lassul.us" ];
    locations = [
      (nameValuePair "/" ''
        root /srv/http/lassul.us;
      '')
      (nameValuePair "/.well-known/acme-challenge" ''
        root /var/lib/acme/challenges/lassul.us/;
      '')
    ];
    ssl = {
      enable = true;
      certificate = "/var/lib/acme/lassul.us/fullchain.pem";
      certificate_key = "/var/lib/acme/lassul.us/key.pem";
    };
  };

  krebs.nginx.servers.cgit = {
    server-names = [
      "cgit.lassul.us"
    ];
    locations = [
      (nameValuePair "/.well-known/acme-challenge" ''
        root /var/lib/acme/challenges/cgit.lassul.us/;
      '')
    ];
    ssl = {
      enable = true;
      certificate = "/var/lib/acme/cgit.lassul.us/fullchain.pem";
      certificate_key = "/var/lib/acme/cgit.lassul.us/key.pem";
    };
  };

  users.users.blog = {
    uid = genid "blog";
    description = "lassul.us blog deployment";
    home = "/srv/http/lassul.us";
    useDefaultShell = true;
    createHome = true;
    openssh.authorizedKeys.keys = [
      config.krebs.users.lass.pubkey
    ];
  };
}