aboutsummaryrefslogtreecommitdiff
path: root/modules/websites
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2021-10-22 20:07:14 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2021-10-23 01:43:33 +0200
commit750fe5a43b957b91a26069cf8a4fe19fc7b2633c (patch)
tree79b4fb8d49ad7a38884e8453349635a7f715ad7e /modules/websites
parentfcbdf67afe262bf6b35a4047956b2f8c12a04cb1 (diff)
downloadNix-750fe5a43b957b91a26069cf8a4fe19fc7b2633c.tar.gz
Nix-750fe5a43b957b91a26069cf8a4fe19fc7b2633c.tar.zst
Nix-750fe5a43b957b91a26069cf8a4fe19fc7b2633c.zip
Remove webappdirs
Diffstat (limited to 'modules/websites')
-rw-r--r--modules/websites/default.nix35
-rw-r--r--modules/websites/php-application.nix19
2 files changed, 0 insertions, 54 deletions
diff --git a/modules/websites/default.nix b/modules/websites/default.nix
index 0a78c13..6658c66 100644
--- a/modules/websites/default.nix
+++ b/modules/websites/default.nix
@@ -7,22 +7,6 @@ in
7 certs = mkOption { 7 certs = mkOption {
8 description = "Default websites configuration for certificates as accepted by acme"; 8 description = "Default websites configuration for certificates as accepted by acme";
9 }; 9 };
10 webappDirs = mkOption {
11 description = ''
12 Defines a symlink between /run/current-system/webapps and a store
13 app directory to be used in http configuration. Permits to avoid
14 restarting httpd when only the folder name changes.
15 '';
16 type = types.attrsOf types.path;
17 default = {};
18 };
19 webappDirsName = mkOption {
20 type = str;
21 default = "webapps";
22 description = ''
23 Name of the webapp dir to create in /run/current-system
24 '';
25 };
26 env = mkOption { 10 env = mkOption {
27 default = {}; 11 default = {};
28 description = "Each type of website to enable will target a distinct httpd server"; 12 description = "Each type of website to enable will target a distinct httpd server";
@@ -145,17 +129,6 @@ in
145 }; 129 };
146 }); 130 });
147 }; 131 };
148 # Readonly variables
149 webappDirsPaths = mkOption {
150 type = attrsOf path;
151 readOnly = true;
152 description = ''
153 Full paths of the webapp dir
154 '';
155 default = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair
156 name "/run/current-system/${cfg.webappDirsName}/${name}"
157 ) cfg.webappDirs;
158 };
159 }; 132 };
160 133
161 config.services.httpd = let 134 config.services.httpd = let
@@ -268,14 +241,6 @@ in
268 } 241 }
269 ) groupedCerts; 242 ) groupedCerts;
270 243
271 config.system.extraSystemBuilderCmds = lib.mkIf (builtins.length (builtins.attrValues cfg.webappDirs) > 0) ''
272 mkdir -p $out/${cfg.webappDirsName}
273 ${builtins.concatStringsSep "\n"
274 (attrsets.mapAttrsToList
275 (name: path: "ln -s ${path} $out/${cfg.webappDirsName}/${name}") cfg.webappDirs)
276 }
277 '';
278
279 config.systemd.services = let 244 config.systemd.services = let
280 package = httpdName: config.services.httpd.${httpdName}.package.out; 245 package = httpdName: config.services.httpd.${httpdName}.package.out;
281 cfgFile = httpdName: config.services.httpd.${httpdName}.configFile; 246 cfgFile = httpdName: config.services.httpd.${httpdName}.configFile;
diff --git a/modules/websites/php-application.nix b/modules/websites/php-application.nix
index 23e2b23..3a43a45 100644
--- a/modules/websites/php-application.nix
+++ b/modules/websites/php-application.nix
@@ -110,13 +110,6 @@ in
110 Path to application root 110 Path to application root
111 ''; 111 '';
112 }; 112 };
113 webappName = mkOption {
114 type = nullOr str;
115 default = null;
116 description = ''
117 Alias name for the app, to be used in services.websites.webappDirs
118 '';
119 };
120 webRoot = mkOption { 113 webRoot = mkOption {
121 type = nullOr path; 114 type = nullOr path;
122 description = '' 115 description = ''
@@ -152,14 +145,6 @@ in
152 Full paths to listen for php 145 Full paths to listen for php
153 ''; 146 '';
154 }; 147 };
155 services.phpApplication.webappDirs = mkOption {
156 type = attrsOf path;
157 default = attrsets.filterAttrs (n: v: builtins.hasAttr n cfg.apps) config.services.websites.webappDirsPaths;
158 readOnly = true;
159 description = ''
160 Stable name webapp dirs for httpd
161 '';
162 };
163 }; 148 };
164 149
165 config = { 150 config = {
@@ -186,10 +171,6 @@ in
186 } 171 }
187 ) cfg.apps; 172 ) cfg.apps;
188 173
189 services.websites.webappDirs = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair
190 (if icfg.webappName == null then name else icfg.webappName) icfg.webRoot
191 ) (attrsets.filterAttrs (n: v: !isNull v.webRoot) cfg.apps);
192
193 services.filesWatcher = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair 174 services.filesWatcher = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair
194 "phpfpm-${name}" { 175 "phpfpm-${name}" {
195 restart = true; 176 restart = true;