nur/modules/web-apps/wordpress/php-config.nix

30 lines
979 B
Nix
Raw Normal View History

{ pkgs
, config # system configuration
, appConfig
2021-11-22 22:19:31 +01:00
, php
}:
assert appConfig.php.scriptMemoryLimitMb > appConfig.maxUploadMb;
2021-11-22 22:19:31 +01:00
php.buildEnv {
2021-11-22 22:22:29 +01:00
extensions = { all, ... }: with all; [ imagick ]
++ (pkgs.lib.optional appConfig.opcache.enable opcache)
++ (pkgs.lib.optional appConfig.php.enableXDebug xdebug);
2021-11-22 22:19:31 +01:00
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];
})}
'';
}