This should enable `nix run` to work under shells like fish and zsh, as well as making child shells not needlessly reset any environment that should be inherited. Implementation adapted from NixOS.
This isn't needed anymore, nix 2.0 figures this out automatically now.