]> git.immae.eu Git - perso/Immae/Config/Nix/NUR.git/blobdiff - modules/websites/default.nix
Add a filesWatcher service to restart them when secrets change
[perso/Immae/Config/Nix/NUR.git] / modules / websites / default.nix
index e57f505a86fae43fc3b523c5f9210db6b82a7895..4b21efb75eb386e97a42068313080d132e29cf05 100644 (file)
@@ -91,6 +91,13 @@ in
             };
           });
         };
+        watchPaths = mkOption {
+          type = listOf string;
+          default = [];
+          description = ''
+            Paths to watch that should trigger a reload of httpd
+            '';
+        };
       };
     });
   };
@@ -159,6 +166,13 @@ in
     })
   ) cfg;
 
+  config.services.filesWatcher = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair
+    "httpd${icfg.httpdName}" {
+      paths = icfg.watchPaths;
+      waitTime = 5;
+    }
+  ) cfg;
+
   config.security.acme.certs = let
     typesToManage = attrsets.filterAttrs (k: v: v.enable) cfg;
     flatVhosts = lists.flatten (attrsets.mapAttrsToList (k: v: