Interactive access to a build environment?

For debugging derivations, I’d like something like nix-shell, but that drops me in the temporary build directory that nix-build uses. Is there a way to do that? Maybe an option to either nix-shell or nix-build?

I guess I can just use mktemp myself… Leaves me worried I’m missing something though.

I end up doing something like this a lot:

cd /tmp && nix-shell '<nixpkgs>' -A hello --run genericBuild

Perhaps Nix should have some builtin option to set this up for you though.

1 Like