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