]> Git — Sourcephile - sourcephile-nix.git/blob - servers/mermet/nginx/sourcephile.fr/www.nix
nix: fix nixpkgs-overlays=
[sourcephile-nix.git] / servers / mermet / nginx / sourcephile.fr / www.nix
1 { pkgs, lib, config, ... }:
2 let inherit (config) networking;
3 inherit (config.services) nginx;
4 domain = "sourcephile.fr";
5 srv = "www";
6 in
7 {
8 services.nginx = {
9 virtualHosts."${srv}" = {
10 serverName = "${srv}.${domain}";
11 serverAliases = [ domain ];
12 forceSSL = true;
13 useACMEHost = domain;
14 root = "/home/julm/work/sourcephile/txt";
15 extraConfig = ''
16 access_log ${nginx.logDir}/${domain}/${srv}/access.log json buffer=32k;
17 error_log ${nginx.logDir}/${domain}/${srv}/error.log warn;
18 '';
19 locations."/".extraConfig = ''
20 #autoindex on;
21 fancyindex on;
22 fancyindex_name_length 255;
23 fancyindex_exact_size off;
24 '';
25 locations."/git".return = "302 http://git.${domain}";
26 locations."/codes_sources".return = "302 http://git.${domain}";
27 };
28 };
29 systemd.services.nginx.preStart = lib.mkBefore ''
30 install -D -d -m 750 -o ${nginx.user} -g ${nginx.group} ${nginx.logDir}/${domain}/${srv}/
31 '';
32 }