Hi,
the starship command prompt uses the ‘IN_NIX_SHELL’ variable to show when the shell is a nix-shell. However, when using the new ‘nix shell’ command, it seems that the ‘IN_NIX_SHELL’ environment variable is not being set.
Is there a way to tell when one is in a ‘nix shell’ environment?
Thanks
I found this PR to set IN_NIX_SHELL
also for nix shell
but it looks like it was rejected.
One of the comments suggests looking for a nix store entry in PATH
to determine if you are using nix shell
.
2 Likes
Thanks, so I guess starship needs to implement a workaround. For now I will just set SHLVL in starship.
In case somebody hitting this, there’s a hack implemented in starship to prompt ‘nix shell’
https://github.com/starship/starship/pull/4724
Just need to set heuristic = true
under nix_shell
2 Likes