aboutsummaryrefslogtreecommitdiff
path: root/modules/websites/default.nix
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-06-01 00:01:46 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-06-01 00:01:46 +0200
commit17f6eae9907a122d4472da727ae8b1ac1c40c027 (patch)
tree133ab8877a47ec707cb8c96e561a29e45395fce6 /modules/websites/default.nix
parentf33aade75160a345a721fd60451b9edaa4d10e44 (diff)
downloadNix-17f6eae9907a122d4472da727ae8b1ac1c40c027.tar.gz
Nix-17f6eae9907a122d4472da727ae8b1ac1c40c027.tar.zst
Nix-17f6eae9907a122d4472da727ae8b1ac1c40c027.zip
Add a filesWatcher service to restart them when secrets change
Diffstat (limited to 'modules/websites/default.nix')
-rw-r--r--modules/websites/default.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/websites/default.nix b/modules/websites/default.nix
index e57f505..4b21efb 100644
--- a/modules/websites/default.nix
+++ b/modules/websites/default.nix
@@ -91,6 +91,13 @@ in
91 }; 91 };
92 }); 92 });
93 }; 93 };
94 watchPaths = mkOption {
95 type = listOf string;
96 default = [];
97 description = ''
98 Paths to watch that should trigger a reload of httpd
99 '';
100 };
94 }; 101 };
95 }); 102 });
96 }; 103 };
@@ -159,6 +166,13 @@ in
159 }) 166 })
160 ) cfg; 167 ) cfg;
161 168
169 config.services.filesWatcher = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair
170 "httpd${icfg.httpdName}" {
171 paths = icfg.watchPaths;
172 waitTime = 5;
173 }
174 ) cfg;
175
162 config.security.acme.certs = let 176 config.security.acme.certs = let
163 typesToManage = attrsets.filterAttrs (k: v: v.enable) cfg; 177 typesToManage = attrsets.filterAttrs (k: v: v.enable) cfg;
164 flatVhosts = lists.flatten (attrsets.mapAttrsToList (k: v: 178 flatVhosts = lists.flatten (attrsets.mapAttrsToList (k: v: