Meson fails to find package via cmake after 23.05 -> 23.11 upgrade

We have a flake-provided environment in which meson compiles client code with, amongst other things, geant4.

Meson uses cmake to find geant4.

After switching nixpkgs from 23.05 to 23.11, meson no longer finds geant4.

CMAKE_PREFIX_PATH seems to point at the right place after the switch.

What can we do to get some insight into what is going wrong?

Using a hybrid environment in which geant4 (and Qt) is taken from nixpkgs 23.05, and everything else, including meson and cmake, is taken from nixpkgs 23.11, gets around the problem of meson not being able to find geant4 via cmake.

This would seem to suggest that something that changed in geant4 between nixpkgs 23.05 and 23.11, is responsible. However, looking at the diff between the two versions of geant4:

git diff nixos-23.05..nixos-23.11 -- pkgs/development/libraries/physics/geant4

doesn’t show anything that looks like it might be relevant:

diff --git a/pkgs/development/libraries/physics/geant4/default.nix b/pkgs/development/libraries/physics/geant4/default.nix
index 4e635a08414b..69e1611e0912 100644
--- a/pkgs/development/libraries/physics/geant4/default.nix
+++ b/pkgs/development/libraries/physics/geant4/default.nix
@@ -3,7 +3,8 @@
 , enableQT             ? false # deprecated name
 , enableQt             ? enableQT
 , enableXM             ? false
-, enableOpenGLX11      ? true
+, mesa
+, enableOpenGLX11      ? !mesa.meta.broken
 , enablePython         ? false
 , enableRaytracerX11   ? false
 
@@ -69,7 +70,7 @@ stdenv.mkDerivation rec {
     "-DGEANT4_USE_SYSTEM_EXPAT=ON"
     "-DGEANT4_USE_SYSTEM_ZLIB=ON"
     "-DGEANT4_BUILD_MULTITHREADED=${if enableMultiThreading then "ON" else "OFF"}"
-  ] ++ lib.optionals stdenv.isDarwin [
+  ] ++ lib.optionals (enableOpenGLX11 && stdenv.isDarwin) [
     "-DXQuartzGL_INCLUDE_DIR=${libGL.dev}/include"
     "-DXQuartzGL_gl_LIBRARY=${libGL}/lib/libGL.dylib"
   ] ++ lib.optionals (enableMultiThreading && enablePython) [
@@ -88,11 +89,13 @@ stdenv.mkDerivation rec {
   ];
   dontWrapQtApps = true; # no binaries
 
-  buildInputs = [ libGLU libXext libXmu ]
+  buildInputs =
+    lib.optionals enableOpenGLX11 [ libGLU libXext libXmu ]
     ++ lib.optionals enableInventor [ libXpm coin3d soxt motif ]
     ++ lib.optionals enablePython [ boost_python python3 ];
 
-  propagatedBuildInputs = [ clhep expat xercesc zlib libGL ]
+  propagatedBuildInputs = [ clhep expat xercesc zlib ]
+    ++ lib.optionals enableOpenGLX11 [ libGL ]
     ++ lib.optionals enableXM [ motif ]
     ++ lib.optionals enableQt [ qtbase ];