2 { pkgs, lib, config, ... }:
4 inherit (config) networking;
5 inherit (config.security) gnupg;
6 inherit (config.services) nginx;
8 root = "/var/lib/nginx/${domain}";
11 systemd.services.nginx.serviceConfig = {
13 "/home/julm/work/perso:${root}/julm"
16 "nginx/${domain}/julm"
18 LogsDirectory = lib.mkForce [
19 "nginx/${domain}/${srv}"
23 virtualHosts."${domain}.${srv}" = {
24 serverAliases = [ domain ];
27 root = "${root}/${srv}";
29 access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
30 error_log /var/log/nginx/${domain}/${srv}/error.log warn;
32 locations."/".extraConfig = ''
35 fancyindex_name_length 255;
36 fancyindex_exact_size off;
38 locations."/julm/" = {
39 alias = "${root}/julm/";
44 locations."/julm/PC/" = {
45 alias = "${root}/julm/PC/";
47 auth_basic "restricted area";
48 auth_basic_user_file ${gnupg.secrets."nginx/${domain}/${srv}/julm/PC/htpasswd".path};
50 fancyindex_name_length 255;
51 fancyindex_exact_size off;
56 security.gnupg.secrets = {
57 "nginx/${domain}/${srv}/julm/PC/htpasswd" = {
58 # Generated with: echo "$user:$(openssl passwd -apr1)"
59 systemdConfig.before = [ "nginx.service" ];
60 systemdConfig.wantedBy = [ "nginx.service" ];