2 { lib, config, inputs, hostName, ... }:
 
   4   inherit (config.services) nginx;
 
   6   root = "/var/lib/nginx/${domain}";
 
   9   systemd.services.nginx.serviceConfig = {
 
  10     LogsDirectory = lib.mkForce [
 
  11       "nginx/${domain}/${srv}"
 
  13     LoadCredentialEncrypted = [
 
  14       "${domain}.${srv}.julm.PC.htpasswd:${./. + "/${srv}/julm/PC/htpasswd.cred"}"
 
  15       "${domain}.${srv}.julm.perso.camera.htpasswd:${./. + "/${srv}/julm/perso/camera.htpasswd.cred"}"
 
  19     virtualHosts.${domain} = {
 
  20       serverAliases = [ "${srv}.${domain}" ];
 
  23       root = "${root}/${srv}";
 
  25         access_log /var/log/nginx/${domain}/${srv}/access.log json buffer=32k;
 
  26         error_log  /var/log/nginx/${domain}/${srv}/error.log warn;
 
  28       locations."/".extraConfig = ''
 
  31         fancyindex_name_length 255;
 
  32         fancyindex_exact_size off;
 
  34       locations."/julm/" = {
 
  35         alias = "${root}/julm/";
 
  40       locations."/julm/PC/" = {
 
  41         alias = "${root}/julm/PC/";
 
  42         basicAuthFile = "/run/credentials/nginx.service/${domain}.${srv}.julm.PC.htpasswd";
 
  45           fancyindex_name_length 255;
 
  46           fancyindex_exact_size off;
 
  49       locations."/julm/perso/camera/" = {
 
  50         alias = "${root}/julm/perso/camera/";
 
  51         basicAuthFile = "/run/credentials/nginx.service/${domain}.${srv}.julm.perso.camera.htpasswd";
 
  54           fancyindex_name_length 255;
 
  55           fancyindex_exact_size off;
 
  58       # Disable basicAuthFile for by-uuid
 
  59       locations."~ ^/julm/perso/camera/([0-9]+/[0-9][0-9]/by-uuid/[0-9a-f-]+/.+)$" = {
 
  60         alias = "${root}/julm/perso/camera/$1";