# pkgsStatic clang works for C but not C++

**URL:** https://discourse.nixos.org/t/pkgsstatic-clang-works-for-c-but-not-c/72398
**Category:** Help
**Created:** [November 22, 2025, 11:21pm UTC](https://discourse.nixos.org/t/pkgsstatic-clang-works-for-c-but-not-c/72398 "2025-11-22T23:21:45Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![waffle8946](https://discourse.nixos.org/user_avatar/discourse.nixos.org/waffle8946/32/27221_2.png) [@waffle8946](https://discourse.nixos.org/u/waffle8946)
#### Post date: [November 22, 2025, 11:59pm UTC](https://discourse.nixos.org/t/pkgsstatic-clang-works-for-c-but-not-c/72398/2 "2025-11-22T23:59:01Z")

</div>

> [@Clang, clang++, and clangd can't find headers, even with compile\_commands.json](https://discourse.nixos.org/t/clang-clang-and-clangd-cant-find-headers-even-with-compile-commands-json/54657/6):
>
> What you’re meant to do is override the stdenv if you want it to use clang: pkgs.mkShell.override { stdenv = pkgs.clang19Stdenv; } { packages = [pkgs.cmake # ... whatever else, but NOT C compilers though!]; } (or inherit (pkgs.llvmPackages\_19) stdenv;, if you prefer) and instead of the deprecated devShell.\<system\>, use devShells.\<system\>.default.

---

_[View the full topic](https://discourse.nixos.org/t/pkgsstatic-clang-works-for-c-but-not-c/72398)._
