]> Git — Sourcephile - sourcephile-nix.git/blob - machines/mermet/nginx/sourcephile.fr/public-inbox.nix
hydra: no longer needed
[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://127.0.0.1:${toString public-inbox.http.port}/inbox";
23 locations."/inbox".proxyPass = "http://unix:${public-inbox.http.port}:/inbox";
24 locations."= /style/light.css".alias = pkgs.writeText "light.css" ''
25 * { background:#fff; color:#000 }
26
27 a { color:#00f; text-decoration:none }
28 a:visited { color:#808 }
29
30 *.q { color:#008 }
31
32 *.add { color:#060 }
33 *.del {color:#900 }
34 *.head { color:#000 }
35 *.hunk { color:#960 }
36
37 .hl.num { color:#f30 } /* number */
38 .hl.esc { color:#f0f } /* escape character */
39 .hl.str { color:#f30 } /* string */
40 .hl.ppc { color:#c3c } /* preprocessor */
41 .hl.pps { color:#f30 } /* preprocessor string */
42 .hl.slc { color:#099 } /* single-line comment */
43 .hl.com { color:#099 } /* multi-line comment */
44 /* .hl.opt { color:#ccc } */ /* operator */
45 /* .hl.ipl { color:#ccc } */ /* interpolation */
46
47 /* keyword groups kw[a-z] */
48 .hl.kwa { color:#f90 }
49 .hl.kwb { color:#060 }
50 .hl.kwc { color:#f90 }
51 /* .hl.kwd { color:#ccc } */
52 '';
53 };
54 };
55 systemd.services.nginx.serviceConfig.LogsDirectory = lib.mkForce ["nginx/${domain}/${srv}"];
56 }