Php-gd extension compiled with libjpeg, libpng & more

Greetings everyone, NixOS noob here.

I installed Nextcloud 33 on a RiscV board, and I am cross-building NixOS from a x86_64 Arch based machine (probably not relevant, but I don’t want to omit possibly relevant details). The main issue is that neither the gd library of the php-gd extension are compiled with libpng, libjpeg and other libs. I already solved the issue with gd with an overlay in which I override with overrideAttrs.

The main trouble revolves around trying to override the configuration for the PHP extension – I tried many things, including an overlay on the php package with the changes to the extensions set and passing an explicitly modified phpPackage to services.nextcloud, without any success. I tried to ask a couple of LLMs for some help, but in this case they have not been so much useful (at a certain point one of them started hallucinating quite a bit about which attributes where available).

As said, I am totally noob in NixOS, and I probably stumbled on a not-really-beginner-friendly problem to solve, hopefully it’s something trivial for most of you. My gut feelings are that I was not able to correctly handle the overlay/override because of the mkScope of the PHP package.

If this issue have been already discussed and documented, I am sorry but I have not been able to find anything specific. In any case, thank you for you help.