diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-06-02 14:31:25 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-04-25 00:04:24 +0200 |
commit | fb7f2ad86ebdee514b3b361aa5615e333ac66780 (patch) | |
tree | 062a87810e7d705ff20a21e0620da71a71bebe84 | |
parent | 55ebe7be7375fe58c5e8a6f8edc31f768ddf5e6f (diff) | |
download | NUR-fb7f2ad86ebdee514b3b361aa5615e333ac66780.tar.gz NUR-fb7f2ad86ebdee514b3b361aa5615e333ac66780.tar.zst NUR-fb7f2ad86ebdee514b3b361aa5615e333ac66780.zip |
Move florian php configuration to dedicated module
-rw-r--r-- | modules/websites/php-application.nix | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/modules/websites/php-application.nix b/modules/websites/php-application.nix index 1bc4872e..8ad7a0df 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 | }; |