PHP extensions not building against PHP with overridden attributes

There are actually two issues with your code:

  • pcov module is built using buildPecl which uses php attribute from the scope. You should therefore override php, not phpPackage (it was actually changed recently).

  • unwrapped is defined in a passthru so you will have to override it as such or it will be shadowed.

    php_wrapped = pkgs.php.overrideAttrs (attrs: {
     passthru = attrs.passthru // {
       unwrapped = php_with_debug;
     };
    });
    

    Though I would not recommend it since it might no longer reflect reality after future overlays.

    Again, looking at the source code, it does not look like there is a convenient way to override it since the php value is created using generic function taken from the parent scope, not any function arguments.

    I would suggest just calling withExtensions on the unwrapped PHP but that would lose the list of extensions enabled by default. And also that does not actually work since mkBuildEnv will refer to the pre-overridden php. So it looks like it is not possible to do it cleanly with the PHP package as currently written.

1 Like