Ignoring the devshell environment (this is a major issue for nix)

Previously discussed a bit here.

Background on nix: a flake.nix can lay out all of the development dependencies so that whenever a dev comes to the project they can immediately get their environment set up by just running nix develop, then launching vscode, and that vscode window will be able to access everything, (Once they’re done with the dev environment, nix can garbage collect those dev dependencies.)

But this currently doesn’t always work with cursor. The shell environment, the PATH environmental variable, isn’t always inherited from the shell in which cursor was launched, so cursor wont be able to see any libraries or sdks that nix is trying to provide.

It seems like this is happening because Cursor windows all share the initial shell environment that the first window was launched under. Any subsequent windows will ignore the shell environment they were launched under. This prevents some users from having more than one local nix environment open in Cursor at the same time, and it’s also confusing and costs us each many hours.

Why was this difference from vscode introduced?

Steps to reproduce

Open a terminal. Open cursor from this terminal. Open a fresh terminal. Run export VARI="inherited variable"; cursor. Open the built in terminal in this cursor window, run echo $VARI. You will see that cursor’s terminal has failed to inherit the variable.

(While, if you’d instead exported VARI from the first terminal, it will be inherited, even by the second window, which shouldn’t have inherited it)

System information

Nixos, Cursor 0.42.4