mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 12:15:34 +03:00
php.packages: Make packages overridable
This will allow patching extensions without having to manually having to patch all occurrences in the dependency tree.
This commit is contained in:
parent
7e8b2b7e98
commit
b2594c71c2
2 changed files with 20 additions and 1 deletions
|
@ -135,3 +135,21 @@ Example of building `composer` with additional extensions:
|
||||||
enabled ++ (with all; [ imagick redis ]))
|
enabled ++ (with all; [ imagick redis ]))
|
||||||
).packages.composer
|
).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 [] ++ [
|
||||||
|
…
|
||||||
|
];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
|
@ -13,6 +13,7 @@ let
|
||||||
, version
|
, version
|
||||||
, sha256
|
, sha256
|
||||||
, extraPatches ? []
|
, extraPatches ? []
|
||||||
|
, packageOverrides ? (final: prev: {})
|
||||||
|
|
||||||
# Sapi flags
|
# Sapi flags
|
||||||
, cgiSupport ? true
|
, cgiSupport ? true
|
||||||
|
@ -50,7 +51,7 @@ let
|
||||||
|
|
||||||
php-packages = (callPackage ../../../top-level/php-packages.nix {
|
php-packages = (callPackage ../../../top-level/php-packages.nix {
|
||||||
phpPackage = phpWithExtensions;
|
phpPackage = phpWithExtensions;
|
||||||
});
|
}).overrideScope' packageOverrides;
|
||||||
|
|
||||||
allExtensionFunctions = prevExtensionFunctions ++ [ extensions ];
|
allExtensionFunctions = prevExtensionFunctions ++ [ extensions ];
|
||||||
enabledExtensions =
|
enabledExtensions =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue