I am using Nix to create a developer shell environment where certain environment variables are set to properly compile my projects. Instead of installing these globally, I like to keep them confined within a nix configuration file per project.
The issue I am bumping into is that Cursor does something different from VSCode.
When I launch VSCode from the terminal by doing code . in my terminal, the editor will have the environment variables inherited, e.g. PKG_CONFIG_PATH. However, cursor . does not do the same for at least that specific environment variable.
This leads to errors within my editor for my Rust language server like this:
The system library `gdk-3.0` required by crate `gdk-sys` was not found.
The file `gdk-3.0.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
PKG_CONFIG_PATH contains the following:
- /usr/lib/pkgconfig
Somehow the PKG_CONFIG_PATH is overridden in Cursor.
Yeah, I’m also running into this. It’s preventing me from using cursor for flutter development on nixos. It’s unable to find the Sdk.
Oddly, before restarting, I wasn’t having this problem, cursor had found the sdk. Don’t know why. (Is it possible it had inherited the shell environment from my vscode installation?)
Ah, I killed all cursor windows (killall cursor) and restarted from a shell I was nix develop in and now it can find the dart sdk.
I vaguely remember it finding the flutter sdk earlier even though I didn’t at that time launch it from a devshell, this would explain how that happened; somehow, I guess cursor windows all inherit from the shell that cursor was first launched from?
The problem seems clear enough to be pretty actionable at this point.