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