]> Git — Sourcephile - sourcephile-nix.git/blob - machines/mermet/nginx/sourcephile.fr/public-inbox.nix
upnpc: use DHCP and UPnP on losurdo
[sourcephile-nix.git] / machines / mermet / nginx / sourcephile.fr / public-inbox.nix
1 { domain, ... }:
2 { pkgs, lib, config, ... }:
3 let
4 inherit (config) networking;
5 inherit (config.services) nginx public-inbox;
6 srv = "public-inbox";
7 in
8 {
9 services.nginx = {
10 virtualHosts."${srv}" = {
11 serverName = "${srv}.${domain}";
12 serverAliases = [ "mails.${domain}" ];
13 forceSSL = true;
14 useACMEHost = domain;
15 #root = "/home/julm/work/sourcephile/txt";
16 extraConfig = ''
17 access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
18 error_log /var/log/nginx/${domain}/${srv}/error.log warn;
19 '';
20 locations."/".return = "302 /inbox";
21 locations."= /inbox".return = "302 /inbox/";
22 locations."/inbox".proxyPass = "http://unix:${builtins.head public-inbox.http.listenStreams}:/inbox";
23 locations."= /style/light.css".alias = pkgs.writeText "light.css" ''
24 * { background:#fff; color:#000 }
25
26 a { color:#00f; text-decoration:none }
27 a:visited { color:#808 }
28
29 *.q { color:#008 }
30
31 *.add { color:#060 }
32 *.del {color:#900 }
33 *.head { color:#000 }
34 *.hunk { color:#960 }
35
36 .hl.num { color:#f30 } /* number */
37 .hl.esc { color:#f0f } /* escape character */
38 .hl.str { color:#f30 } /* string */
39 .hl.ppc { color:#c3c } /* preprocessor */
40 .hl.pps { color:#f30 } /* preprocessor string */
41 .hl.slc { color:#099 } /* single-line comment */
42 .hl.com { color:#099 } /* multi-line comment */
43 /* .hl.opt { color:#ccc } */ /* operator */
44 /* .hl.ipl { color:#ccc } */ /* interpolation */
45
46 /* keyword groups kw[a-z] */
47 .hl.kwa { color:#f90 }
48 .hl.kwb { color:#060 }
49 .hl.kwc { color:#f90 }
50 /* .hl.kwd { color:#ccc } */
51 '';
52 };
53 };
54 systemd.services.nginx.serviceConfig.LogsDirectory = lib.mkForce ["nginx/${domain}/${srv}"];
55 }