All would be fine. I can run nix-build or nix-shell without problems. But if I run nix-build inside of nix-shell, nix-build will not produce a result folder but a result ASCII text file.
And because I use .envrc with use nix to load the nix file and have all the dev dependencies, nix-shell is started and nix-build will no more work (produce ASCII text file instead of folder).
Extracting the dev dependencies out into a shell.nix file does not help.
So far I haven’t run into any problems with it, but then I only use it very sparingly. I might for instance put something like IN_NIX_SHELL= nix-build into a Makefile to easily test, during development, that a full build still works. Just to not have to deny/allow direnv manually.
I suspect it’s there for a reason though, so wouldn’t unset the variable all the time.