How to debug dependency failure

Hi,

Motivation:
I want to try fresh GHC which support linear let bindings.
The language feature requires a complex library (linear-base) and it requires to build lot of dependencies. One of them is happy tool.
I created a nix project overriding GHC version from git head and overriding failing dependencies with branched versions.

At current state entering nix-shell ends with

/nix/store/jsjfmx7r6cpyixxsg7bjl5cy3y8hw7k7-binutils-wrapper-2.41/bin/ld.gold
No pkg-config found
Using runghc version 9.8.1 found on system at:
/nix/store/h1d5q7770r20b5vfhg32s9bi88bs4cfw-ghc-9.8.1/bin/runghc-9.8.1
Using strip version 2.41 found on system at:
/nix/store/ac1hb5dc2z4biwgy8mjrhlifffkkrvdq-gcc-wrapper-13.2.0/bin/strip
Using tar found on system at:
/nix/store/xwvgwr85gghbl66kj30sp19p2y1cypqv-gnutar-1.35/bin/tar
No uhc found
Running phase: buildPhase
Preprocessing executable 'happy' for happy-1.21.0..
Error: Setup: The program 'happy' is required but it could not be found

error: builder for '/nix/store/ccphy1szsn9fg2lx80p299bib2ky9izp-happy-1.21.0.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/l73rh8grlx1wqsjshdf344x44c75g2cj-ghc-9.8.1-with-packages.drv' failed to build

I don’t understand what is wrong, because happy build almost finished without error.

Ideally would be to have an option to treat such condition as an “exception” and drop into a bash shell without loosing context - i.e. uncommitted files to nix storage to do investigation. Can nix do such kind of trick?

Any advice how to get more info about such issue is welcome.

project reproducing the error

just for reference