modules(wp): rewire php correctly
This commit is contained in:
parent
b8a237fe65
commit
b7035923ab
|
@ -10,10 +10,10 @@ let
|
|||
});
|
||||
writeableDataPath = "/var/lib/phpfpm/${appConfig.name}";
|
||||
phpFpmListen = "/run/phpfpm/wordpress-pool.sock";
|
||||
phpIni = import ./php-config.nix { inherit pkgs config appConfig;
|
||||
phpPackages = pkgs.php74Packages;
|
||||
phpExtensions = pkgs.php74Extensions;
|
||||
php = import ./php-config.nix { inherit pkgs config appConfig;
|
||||
php = pkgs.php74;
|
||||
};
|
||||
phpIni = php.phpIni;
|
||||
enablePageSpeed = pkgs.stdenv.isLinux && appConfig.googlePageSpeed.enable;
|
||||
app = callPackage ./app.nix {
|
||||
inherit appConfig;
|
||||
|
@ -73,9 +73,9 @@ in {
|
|||
};
|
||||
|
||||
services.phpfpm = {
|
||||
phpOptions = phpIni;
|
||||
pools.wordpress-pool = import ./phpfpm-conf.nix {
|
||||
inherit pkgs config phpFpmListen;
|
||||
phpPackage = php;
|
||||
processSettings = appConfig.phpFpmProcessSettings;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,36 +1,26 @@
|
|||
{ pkgs
|
||||
, config # system configuration
|
||||
, appConfig
|
||||
, phpPackages
|
||||
, phpExtensions
|
||||
, php
|
||||
}:
|
||||
|
||||
assert appConfig.php.scriptMemoryLimitMb > appConfig.maxUploadMb;
|
||||
|
||||
''
|
||||
memory_limit ${toString appConfig.php.scriptMemoryLimitMb}M
|
||||
php.buildEnv {
|
||||
extensions = { all, ... }: with all; [ imagick ] ++ pkgs.lib.optional appConfig.opcache.enable [ opcache ] ++ pkgs.lib.optional appConfig.php.enableXDebug [ xdebug ];
|
||||
extraConfig = ''
|
||||
memory_limit = ${toString appConfig.php.scriptMemoryLimitMb}M
|
||||
upload_max_filesize = ${toString appConfig.maxUploadMb}M
|
||||
post_max_size = ${toString appConfig.maxUploadMb}M
|
||||
max_execution_time ${toString appConfig.php.maxExecutionTimeSec}
|
||||
|
||||
extension = "${phpExtensions.imagick}/lib/php/extensions/imagick.so"
|
||||
date.timezone = "${appConfig.timezone}"
|
||||
sendmail_path = ${appConfig.php.sendmailPath}
|
||||
|
||||
${pkgs.lib.optionalString appConfig.opcache.enable ''
|
||||
zend_extension = "${config.services.phpfpm.phpPackage}/lib/php/extensions/opcache.so"
|
||||
''}
|
||||
|
||||
${pkgs.lib.optionalString appConfig.php.enableXDebug ''
|
||||
; WARNING: Be sure to load opcache *before* xdebug (http://us3.php.net/manual/en/opcache.installation.php).
|
||||
zend_extension = "${phpPackages.xdebug}/lib/php/extensions/xdebug.so"
|
||||
''}
|
||||
|
||||
upload_max_filesize = ${toString appConfig.maxUploadMb}M
|
||||
post_max_size = ${toString appConfig.maxUploadMb}M
|
||||
max_execution_time ${toString appConfig.php.maxExecutionTimeSec}
|
||||
|
||||
date.timezone = "${appConfig.timezone}"
|
||||
sendmail_path = ${appConfig.php.sendmailPath}
|
||||
|
||||
${import ./opcache-config.nix (appConfig.opcache // {
|
||||
# Enable timestamp validation if the setup is not entirely frozen (managed by Nix).
|
||||
validateTimestamps = ! builtins.all (x: x)
|
||||
[appConfig.freezeWordPress appConfig.freezePlugins appConfig.freezeThemes];
|
||||
})}
|
||||
''
|
||||
${import ./opcache-config.nix (appConfig.opcache // {
|
||||
# Enable timestamp validation if the setup is not entirely frozen (managed by Nix).
|
||||
validateTimestamps = ! builtins.all (x: x)
|
||||
[appConfig.freezeWordPress appConfig.freezePlugins appConfig.freezeThemes];
|
||||
})}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{ pkgs, config, phpFpmListen, processSettings }:
|
||||
{ pkgs, config, phpFpmListen, processSettings, phpPackage }:
|
||||
{
|
||||
inherit (config.services.nginx) user group;
|
||||
inherit phpPackage;
|
||||
settings = {
|
||||
"listen.owner" = config.services.nginx.user;
|
||||
"listen.group" = config.services.nginx.group;
|
||||
|
|
Loading…
Reference in a new issue