]> Git — Sourcephile - sourcephile-nix.git/blob - hosts/mermet/nginx/sourcephile.fr/public-inbox.nix
sourcehut: oauth-client-{id,secret} aren't optional
[sourcephile-nix.git] / hosts / 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}.${domain}" = {
11 serverAliases = [ "mails.${domain}" ];
12 forceSSL = true;
13 useACMEHost = domain;
14 #root = "/home/julm/work/sourcephile/txt";
15 extraConfig = ''
16 access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
17 error_log /var/log/nginx/${domain}/${srv}/error.log warn;
18 '';
19 locations."/".return = "302 /inbox";
20 locations."= /inbox".return = "302 /inbox/";
21 #locations."/inbox".proxyPass = "http://127.0.0.1:${toString public-inbox.http.port}/inbox";
22 locations."/inbox".proxyPass = "http://unix:${public-inbox.http.port}:/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 }