aboutsummaryrefslogtreecommitdiff
path: root/modules/websites
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-06-02 14:31:25 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-06-02 22:08:03 +0200
commit1594c8da6fbb4ffa09ab970fb887cea61c572f60 (patch)
tree12c9bb94173f3d7ba67a70f1846f5cd381f2c985 /modules/websites
parent717ccfd957e686d773480df817387aebbe79aa48 (diff)
downloadNix-1594c8da6fbb4ffa09ab970fb887cea61c572f60.tar.gz
Nix-1594c8da6fbb4ffa09ab970fb887cea61c572f60.tar.zst
Nix-1594c8da6fbb4ffa09ab970fb887cea61c572f60.zip
Move florian php configuration to dedicated module
Diffstat (limited to 'modules/websites')
-rw-r--r--modules/websites/php-application.nix20
1 files changed, 18 insertions, 2 deletions
diff --git a/modules/websites/php-application.nix b/modules/websites/php-application.nix
index 1bc4872..8ad7a0d 100644
--- a/modules/websites/php-application.nix
+++ b/modules/websites/php-application.nix
@@ -19,6 +19,13 @@ in
19 Path to application’s vardir. 19 Path to application’s vardir.
20 ''; 20 '';
21 }; 21 };
22 varDirPaths = mkOption {
23 type = attrsOf str;
24 default = {};
25 description = ''
26 Map of additional folders => mode to create under varDir
27 '';
28 };
22 mode = mkOption { 29 mode = mkOption {
23 type = str; 30 type = str;
24 default = "0700"; 31 default = "0700";
@@ -163,7 +170,7 @@ in
163 listen.group = ${icfg.httpdGroup} 170 listen.group = ${icfg.httpdGroup}
164 ${optionalString (icfg.phpSession) '' 171 ${optionalString (icfg.phpSession) ''
165 php_admin_value[session.save_path] = "${icfg.varDir}/phpSessions"''} 172 php_admin_value[session.save_path] = "${icfg.varDir}/phpSessions"''}
166 php_admin_value[open_basedir] = "${builtins.concatStringsSep ":" ([icfg.app icfg.varDir] ++ icfg.phpOpenbasedir)}" 173 php_admin_value[open_basedir] = "${builtins.concatStringsSep ":" ([icfg.app icfg.varDir] ++ icfg.phpWatchFiles ++ icfg.phpOpenbasedir)}"
167 '' + icfg.phpPool; 174 '' + icfg.phpPool;
168 phpOptions = config.services.phpfpm.phpOptions + icfg.phpOptions; 175 phpOptions = config.services.phpfpm.phpOptions + icfg.phpOptions;
169 } 176 }
@@ -173,6 +180,13 @@ in
173 (if icfg.webappName == null then name else icfg.webappName) icfg.webRoot 180 (if icfg.webappName == null then name else icfg.webappName) icfg.webRoot
174 ) (attrsets.filterAttrs (n: v: !isNull v.webRoot) cfg.apps); 181 ) (attrsets.filterAttrs (n: v: !isNull v.webRoot) cfg.apps);
175 182
183 services.filesWatcher = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair
184 "phpfpm-${name}" {
185 restart = true;
186 paths = icfg.phpWatchFiles;
187 }
188 ) (attrsets.filterAttrs (n: v: builtins.length v.phpWatchFiles > 0) cfg.apps);
189
176 systemd.services = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair 190 systemd.services = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair
177 "phpfpm-${name}" { 191 "phpfpm-${name}" {
178 after = lib.mkAfter icfg.serviceDeps; 192 after = lib.mkAfter icfg.serviceDeps;
@@ -210,7 +224,9 @@ in
210 install -m ${icfg.mode} -o ${icfg.httpdUser} -g ${icfg.httpdGroup} -d ${icfg.varDir} 224 install -m ${icfg.mode} -o ${icfg.httpdUser} -g ${icfg.httpdGroup} -d ${icfg.varDir}
211 '' + optionalString (icfg.phpSession) '' 225 '' + optionalString (icfg.phpSession) ''
212 install -m 0700 -o ${icfg.httpdUser} -g ${icfg.httpdGroup} -d ${icfg.varDir}/phpSessions 226 install -m 0700 -o ${icfg.httpdUser} -g ${icfg.httpdGroup} -d ${icfg.varDir}/phpSessions
213 ''; 227 '' + builtins.concatStringsSep "\n" (attrsets.mapAttrsToList (n: v: ''
228 install -m ${v} -o ${icfg.httpdUser} -g ${icfg.httpdGroup} -d ${icfg.varDir}/${n}
229 '') icfg.varDirPaths);
214 } 230 }
215 ) cfg.apps; 231 ) cfg.apps;
216 }; 232 };