tide icon indicating copy to clipboard operation
tide copied to clipboard

Add support for `nix shell` detection

Open scaryrawr opened this issue 1 year ago • 2 comments

Description

When using nix shell, the IN_NIX_SHELL variable is not set.

A common workaround is to check if /nix/store/ is on the PATH.

Motivation and Context

nix shell does not set $IN_NIX_SHELL

Closes #542

Screenshots (if appropriate)

How Has This Been Tested

  • [ ] I have tested using Linux.
  • [x] I have tested using MacOS.

Checklist

  • [x] I am ready to update the wiki accordingly.
  • [x] I have updated the tests accordingly.

scaryrawr avatar Mar 28 '25 14:03 scaryrawr

A common workaround is to check if /nix/store/ is on the PATH.

Is that really a common workaround? Wouldn't that always identify a NixOS environment as a nix shell?

calops avatar Mar 31 '25 22:03 calops

A common workaround is to check if /nix/store/ is on the PATH.

Is that really a common workaround? Wouldn't that always identify a NixOS environment as a nix shell?

Ah, maybe not common, but it is how starship treats it. They have an unknown option vs pure/impure where if they're in an NixOS environment.

scaryrawr avatar Apr 01 '25 14:04 scaryrawr