- services.websitesWebappDirs = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair
- icfg.webappName icfg.webRoot
- ) (attrsets.filterAttrs (n: v: !isNull v.webappName && !isNull v.webRoot) cfg);
+ services.phpfpm.pools = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair
+ name {
+ user = icfg.httpdUser;
+ group = icfg.httpdUser;
+ settings = {
+ "listen.owner" = icfg.httpdUser;
+ "listen.group" = icfg.httpdGroup;
+ "php_admin_value[open_basedir]" = builtins.concatStringsSep ":" ([icfg.app icfg.varDir] ++ icfg.phpWatchFiles ++ icfg.phpOpenbasedir);
+ }
+ // optionalAttrs (icfg.phpSession) { "php_admin_value[session.save_path]" = "${icfg.varDir}/phpSessions"; }
+ // icfg.phpPool;
+ phpOptions = config.services.phpfpm.phpOptions + icfg.phpOptions;
+ inherit (icfg) phpEnv phpPackage;
+ }
+ ) cfg.apps;
+
+ services.websites.webappDirs = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair
+ (if icfg.webappName == null then name else icfg.webappName) icfg.webRoot
+ ) (attrsets.filterAttrs (n: v: !isNull v.webRoot) cfg.apps);
+
+ services.filesWatcher = attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair
+ "phpfpm-${name}" {
+ restart = true;
+ paths = icfg.phpWatchFiles;
+ }
+ ) (attrsets.filterAttrs (n: v: builtins.length v.phpWatchFiles > 0) cfg.apps);