nixos/icingaweb2, nixos/restya-board, nixos/zoneminder: set phpOptions per phpfpm pool, instead of applying to every phpfpm pool

This commit is contained in:
Aaron Andersen 2019-02-28 22:12:38 -05:00
parent 898870824d
commit cddb117b96
3 changed files with 51 additions and 50 deletions

View File

@ -275,14 +275,14 @@ in {
}; };
phpfpm = lib.mkIf useNginx { phpfpm = lib.mkIf useNginx {
pools.zoneminder = {
listen = socket;
phpOptions = '' phpOptions = ''
date.timezone = "${config.time.timeZone}" date.timezone = "${config.time.timeZone}"
${lib.concatStringsSep "\n" (map (e: ${lib.concatStringsSep "\n" (map (e:
"extension=${e.pkg}/lib/php/extensions/${e.name}.so") phpExtensions)} "extension=${e.pkg}/lib/php/extensions/${e.name}.so") phpExtensions)}
''; '';
pools.zoneminder = {
listen = socket;
extraConfig = '' extraConfig = ''
user = ${user} user = ${user}
group = ${group} group = ${group}

View File

@ -546,8 +546,13 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.phpfpm.poolConfigs = mkIf (cfg.pool == "${poolName}") { services.phpfpm.poolConfigs = mkIf (cfg.pool == "${poolName}") {
"${poolName}" = '' "${poolName}" = {
listen = "${phpfpmSocketName}" listen = phpfpmSocketName;
phpOptions = ''
extension = ${pkgs.phpPackages.imagick}/lib/php/extensions/imagick.so
date.timezone = "${cfg.timezone}"
'';
extraConfig = ''
listen.owner = nginx listen.owner = nginx
listen.group = nginx listen.group = nginx
listen.mode = 0600 listen.mode = 0600
@ -559,12 +564,7 @@ in {
pm.max_spare_servers = 10 pm.max_spare_servers = 10
''; '';
}; };
};
services.phpfpm.phpOptions = mkIf (cfg.pool == "${poolName}")
''
extension = ${pkgs.phpPackages.imagick}/lib/php/extensions/imagick.so
date.timezone = "${cfg.timezone}"
'';
systemd.services."phpfpm-${poolName}".serviceConfig.ReadWritePaths = [ "/etc/icingaweb2" ]; systemd.services."phpfpm-${poolName}".serviceConfig.ReadWritePaths = [ "/etc/icingaweb2" ];

View File

@ -179,8 +179,19 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.phpfpm.poolConfigs = { services.phpfpm.poolConfigs = {
"${poolName}" = '' "${poolName}" = {
listen = "${phpfpmSocketName}"; listen = phpfpmSocketName;
phpOptions = ''
date.timezone = "CET"
${optionalString (!isNull cfg.email.server) ''
SMTP = ${cfg.email.server}
smtp_port = ${toString cfg.email.port}
auth_username = ${cfg.email.login}
auth_password = ${cfg.email.password}
''}
'';
extraConfig = ''
listen.owner = nginx listen.owner = nginx
listen.group = nginx listen.group = nginx
listen.mode = 0600 listen.mode = 0600
@ -195,17 +206,7 @@ in
catch_workers_output = 1 catch_workers_output = 1
''; '';
}; };
};
services.phpfpm.phpOptions = ''
date.timezone = "CET"
${optionalString (!isNull cfg.email.server) ''
SMTP = ${cfg.email.server}
smtp_port = ${toString cfg.email.port}
auth_username = ${cfg.email.login}
auth_password = ${cfg.email.password}
''}
'';
services.nginx.enable = true; services.nginx.enable = true;
services.nginx.virtualHosts."${cfg.virtualHost.serverName}" = { services.nginx.virtualHosts."${cfg.virtualHost.serverName}" = {