Debugging broken builds

When debugging the creation of a new package, or a currently failing one, seem to be lacking the most basic debug tools.
It feels like this should be something entirely trivial, but I still haven’t figured out how to do it. What am I missing?

In particular, say I am working (as I just was) on python-redis-lock.

To see whether the package builds, I run:

nix-build -I nixpkgs=/home/klaas/nixpkgs/master/ -A pkgs.python3Packages.python-redis-lock '<nixpkgs>'

This fails with an error message in the tests. This error message points me in some general direction, but I’d like to e.g. put a breakpoint in the failing tests (in Python: import pdb; pdb.set_trace()) to really dive into it.

What I want, is to be placed in an environment just like the failing build, and to have (or be able to get, using commands) an overview of the steps that the actual build would take.

How can this be achieved?