nix: update switch from julm-nix
[sourcephile-nix.git] / hosts / mermet / nginx / autogeree.net / www.nix
index f1f5e6dfc55e42478da3979c19292bb331688885..e644af7fd3b94f3e38a3a30e8a53ed6355ece383 100644 (file)
@@ -7,17 +7,12 @@ let
 in
 {
   systemd.services.nginx.serviceConfig = {
-    BindPaths = [
-      "/home/julm/work/perso:${root}/julm"
-    ];
-    StateDirectory = [
-      "nginx/${domain}/julm"
-    ];
     LogsDirectory = lib.mkForce [
       "nginx/${domain}/${srv}"
     ];
     LoadCredentialEncrypted = [
-      "${domain}.${srv}.julm.PC.htpasswd:${inputs.self}/hosts/${hostName}/nginx/${domain}/${srv}/julm/PC/htpasswd.cred"
+      "${domain}.${srv}.julm.PC.htpasswd:${./. + "/${srv}/julm/PC/htpasswd.cred"}"
+      "${domain}.${srv}.julm.perso.camera.htpasswd:${./. + "/${srv}/julm/perso/camera.htpasswd.cred"}"
     ];
   };
   services.nginx = {
@@ -51,6 +46,22 @@ in
           fancyindex_exact_size off;
         '';
       };
+      locations."/julm/perso/camera/" = {
+        alias = "${root}/julm/perso/camera/";
+        basicAuthFile = "/run/credentials/nginx.service/${domain}.${srv}.julm.perso.camera.htpasswd";
+        extraConfig = ''
+          fancyindex on;
+          fancyindex_name_length 255;
+          fancyindex_exact_size off;
+        '';
+      };
+      # Disable basicAuthFile for by-uuid
+      locations."~ ^/julm/perso/camera/([0-9]+/[0-9][0-9]/by-uuid/[0-9a-f-]+/.+)$" = {
+        alias = "${root}/julm/perso/camera/$1";
+        extraConfig = ''
+          autoindex off;
+        '';
+      };
     };
   };
 }