I’m working on switching over to NixOS on my desktop and one of the last things I haven’t got fully working is my neovim config. My LSP’s are able to start, and all of them work fine except for clangd. For some reason, it can’t find C/C++ header files for any installed libraries. I have all of the LSPs themselves installed through Mason in Neovim, and I have programs.nix-ld.enable = true enabled so they can be run correctly.

screenshot showing 'file not found' error on '#include <fcntl.h>'

screenshot showing 'file not found' error on '#include <SDL2/SDL2.h>'

Here is the shell.nix file I’m using for this project:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell.override { stdenv = pkgs.gccStdenv; } {
  nativeBuildInputs = with pkgs.buildPackages; [
    glibc libgcc
    clang-tools libclang
    SDL2 SDL2_image SDL2_sound
  ]; 
  CPATH = pkgs.lib.makeSearchPathOutput "dev" "include" pkgs.glibc pkgs.SDL2 pkgs.SDL2_Image pkgs.SDL2_sound;
}

Is there something extra I need to do to get clangd to find the C headers being used by the project? when I actually run gcc it compiles fine, it just can’t seem to find them correctly in Neovim

Edit: Forgot to mention that I’m using this shell with direnv and launching nvim directly from the same shell that I’m compiling from