nur/modules/web-apps/wordpress/php-config.nix
2021-11-22 23:11:24 +01:00

29 lines
993 B
Nix

{ pkgs
, config # system configuration
, appConfig
, php
}:
assert appConfig.php.scriptMemoryLimitMb > appConfig.maxUploadMb;
php.buildEnv {
extensions = { all, ... }: with all; [ imagick pdo pdo_mysql ]
++ (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}
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];
})}
'';
}