[Nix-dev] Custom php.ini for cli calls
Guillaume Maudoux (Layus)
layus.on at gmail.com
Thu Feb 4 17:14:59 CET 2016
Hi,
I found a hint on StackOverflow[1], which outlines that php is not the
product of a makeDerivation, but instead is a composableDerivation.
More info on these strange beasts can be found in the source itself[2],
with php being explicitly cited as an exception.
Once you know it, you notice it at the top of php/default.nix :-).
Basically, |overrideDerivation| is not available for php; instead you
have the choice between |merge| and |replace|
This works for me :
|# In .nixpkgs/config.nix : packageOverrides = pkgs: with pkgs; rec {
php70 = pkgs.php70.merge (oldAttrs: { installPhase = '' # use the old
installPhase if need be ${oldAttrs.installPhase} # Add custom stuff echo
"Strange option" >> $iniFile ''; }); }; |
[1]
http://stackoverflow.com/questions/23660797/nix-composable-derivation-options
[2]
https://github.com/NixOS/nixpkgs/blob/master/lib/composable-derivation.nix
Le 04/02/16 15:52, 4levels a écrit :
> Hi Nix Devs,
>
> I'm trying to increase the memory_limit settings for php cli calls.
> For the phpfpm calls I've managed (a few months ago) to append my
> custom options to the php.ini file as the phpfpm service has an option
> to do so.
> However, for php cli calls, the memory_limit value is usually set to
> unlimited, but not with the default config in the nix package: it has
> a value of 128M (instead of the expected -1).
>
> In the php/default.nix I can see that the ini file is generated in the
> installPhase, but I'm failing to override this.
>
> Do you have any suggestions on how to achieve this?
>
>
> Kind regards,
>
> Erik
>
> Working phpfpm custom ini snippet:
>
> # Custom PHP ini file for apc / memcached
> services.phpfpm.phpIni = pkgs.runCommand "php.ini" {
> options = ''
> date.timezone = Europe/Brussels
> extension = "${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so"
> max_execution_time = 30
> post_max_size = 100M
> upload_max_size = 100M
> upload_max_filesize = 20M
> memory_limit = 256M
> apc.enable = 1
> '';
> }
> ''
> cat ${pkgs.php}/etc/php-recommended.ini > $out
> echo "$options" >> $out
> '';
>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160204/98577348/attachment.html
More information about the nix-dev
mailing list