blob: d60b8840e40adb694ec963cb14153e867b7d0832 (
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
|
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.services.brook;
in
{
options.services.brook.nginx = {
enable = mkEnableOption "brook nginx host handling";
hostAddr = mkOption {
type = types.str;
example = "stream.example.com";
description = ''
Set the virtual host address to use for streaming
If nginx is not already enabled, this module will
enable it for you.
'';
};
acmeHost = mkOption {
type = types.str;
description = ''
An additional host address to use for acme handling. Not setting
this option will disable `useACMEHost` and `forceSSL` for this
virtualhost.
'';
};
};
config = mkIf cfg.nginx.enable {
services.nginx.virtualHosts."${cfg.nginx.hostAddr}" = {
serverAliases = [ cfg.nginx.acmeHost ];
enableACME = false;
useACMEHost = cfg.nginx.acmeHost;
forceSSL = true;
locations."/xmpp-bosh" = mkIf cfg.prosody.enable {
proxyPass = "https://localhost:${cfg.prosody.port}/http-bind";
extraConfig = ''
proxy_set_header Host ${cfg.prosody.guest-domain};
proxy_set_header X-Forwarded-For ${cfg.prosody.guest-domain};
proxy_buffering off;
tcp_nodelay on;
'';
};
locations."/dash" = {
root = "/var/lib";
};
locations."/metrics" = mkIf cfg.metrics.enable {
proxyPass = "http://localhost:${cfg.metrics.port}";
};
};
};
}
|