This repository has no description
1.6 kB
45 lines
1let
2 domain = "ntfy.lassul.us";
3 port = 2586;
4in
5{
6 # ntfy as UnifiedPush distributor for the phone. Anonymous like ntfy.sh:
7 # the phone subscribes to its "up…" topics, app servers (Synapse, phonetpm
8 # daemons) publish to them without an account.
9 services.ntfy-sh = {
10 enable = true;
11 settings = {
12 base-url = "https://${domain}";
13 listen-http = "127.0.0.1:${toString port}";
14 # Visitors are identified by the address nginx appends to
15 # X-Forwarded-For, not by nginx's own address.
16 behind-proxy = true;
17 # No attachments (the module enables them by default).
18 attachment-cache-dir = "";
19 # Publishers are rate limited per IP (60 requests burst, then one per
20 # 5s). Synapse on this host publishes every Matrix push, so exempt
21 # neoprism's own addresses (machines/neoprism/physical.nix).
22 visitor-request-limit-exempt-hosts = "95.217.192.59,2a01:4f9:4a:4f1a::2";
23 };
24 };
25
26 services.nginx.virtualHosts.${domain} = {
27 enableACME = true;
28 forceSSL = true;
29 locations."/" = {
30 proxyPass = "http://127.0.0.1:${toString port}";
31 recommendedProxySettings = true;
32 proxyWebsockets = true;
33 # Subscriptions are long-lived HTTP streams / websockets with a 45s
34 # keepalive; settings from ntfy's nginx example.
35 extraConfig = ''
36 proxy_buffering off;
37 proxy_request_buffering off;
38 proxy_connect_timeout 3m;
39 proxy_send_timeout 3m;
40 proxy_read_timeout 3m;
41 client_max_body_size 0;
42 '';
43 };
44 };
45}