There are actually two issues with your code:
-
pcovmodule is built usingbuildPeclwhich usesphpattribute from the scope. You should therefore overridephp, notphpPackage(it was actually changed recently). -
unwrappedis defined in apassthruso 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
phpvalue is created usinggenericfunction taken from the parent scope, not any function arguments.I would suggest just calling
withExtensionson the unwrapped PHP but that would lose the list of extensions enabled by default. And also that does not actually work sincemkBuildEnvwill refer to the pre-overriddenphp. So it looks like it is not possible to do it cleanly with the PHP package as currently written.