about summary refs log tree commit diff
path: root/ops/modules/www/inbox.tvl.su.nix
blob: 38db5d2a8eda8e322f6495f335a7578a8ee6afa5 (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
{ config, depot, ... }:

{
  imports = [
    ./base.nix
  ];

  config = {
    services.nginx.virtualHosts."inbox.tvl.su" = {
      enableACME = true;
      forceSSL = true;

      extraConfig = ''
        # nginx is incapable of serving a single file at /, hence this hack:
        location = / {
          index /landing-page;
        }

        location = /landing-page {
          types { } default_type "text/html; charset=utf-8";
          alias ${depot.web.inbox};
        }

        # rest of requests is proxied to public-inbox-httpd
        location / {
          proxy_pass http://localhost:${toString config.services.public-inbox.http.port};
        }
      '';
    };
  };
}