Vscode with nix-shell

Hello,

I am using vscode to develop in C++, but since I also use nix-shell for the building environment a lot of the “magic” from vscode is missing (since it can’t find the headers or cmake etc.). If I start vscode from the nix-shell then some of these problems go away since it can now find the binaries, but I still need to update the includePath for library headers. Is there any magic that points to the /usr/include(?) of the current shell, I would prefer to not add the /nix/store/yilrw348… to the path.

shell.nix:

with import <nixpkgs> {};
{
  buildEnv = stdenv.mkDerivation {
    name = "project";
    buildInputs = [
      cmake
      valgrind
      gdb
      gnumake
      qt5Full
    ];
  };
}
1 Like