QT_PLUGIN_PATH unset in test phase

I am creating a package for a pyqt application using libsForQt5.callPackage and qt5.mkDerivationWith buildPythonApplication. The test phase fails with

running install tests
  qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
  This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
  Available platform plugins are: wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx.
  Aborted (core dumped)

and investigating the build env with nix-shell, I see that the QT_PLUGIN_PATH is unset, as opposed to the wrapped executable. The executable works correctly, the problem is only the installCheckPhase.

How can I get a proper Qt environment during the build/the check phases?

Update: The package I am referring to is in this PR: https://github.com/NixOS/nixpkgs/pull/91291.