From b2594c71c248b78b8526a62f43ad74151a31ac3a Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 16 Dec 2020 00:06:42 +0100 Subject: php.packages: Make packages overridable This will allow patching extensions without having to manually having to patch all occurrences in the dependency tree. --- doc/languages-frameworks/php.section.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'doc/languages-frameworks') diff --git a/doc/languages-frameworks/php.section.md b/doc/languages-frameworks/php.section.md index 763beeb59358..5977363323f1 100644 --- a/doc/languages-frameworks/php.section.md +++ b/doc/languages-frameworks/php.section.md @@ -135,3 +135,21 @@ Example of building `composer` with additional extensions: enabled ++ (with all; [ imagick redis ])) ).packages.composer ``` + +### Overriding PHP packages {#ssec-php-user-guide-overriding-packages} + +`php-packages.nix` form a scope, allowing us to override the packages defined within. For example, to apply a patch to a `mysqlnd` extension, you can simply pass an overlay-style function to `php`’s `packageOverrides` argument: + +```nix +php.override { + packageOverrides = final: prev: { + extensions = prev.extensions // { + mysqlnd = prev.extensions.mysqlnd.overrideAttrs (attrs: { + patches = attrs.patches or [] ++ [ + … + ]; + }); + }; + }; +} +``` -- cgit 1.4.1