I’m working on a library that uses hmatrix-gsl. Past GHC 9.6 I’m getting confusing linker errors for libgsl.so: undefined symbol: cblas_ctrmv. An LD_PRELOAD=/nix/store/<HASH>-gsl-2.8/lib/libgslcblas.so fixes the issue, but I do not understand why the symbol is no longer resolved in later toolchain versions; the same libgslcblas.so shows up in ldd for both builds, after all.
After briefly looking around I notice that hmatrix-gsl package does have an onlygsl flag. When enabled it will use linking flags obtained from pkg-config which seem to specify gslcblas which is what you seem to be after.
Your hunch about cabal (meaning cabal-install, the executable) might be correct - cabal might or may not decide to turn this flag on when you upgrade to a different cabal version. The fix is to pass the flags you want explicitly. How to do it with nix is another matter.
Thanks for the suggestion. I’ve updated the MWE to include development environments for both builds: both use cabal 3.16.0.0. Turning flags on/off yielded the same results. Perhaps this is a Nix issue. I’ll leave this open until I find the source of the issue.