Incorrect include directories using Nix's clang
The clang executable on nix is actually a wrapper which among other things adds a few system include directories.
clang_complete passes arguments like this to libclang
clang -I/usr/include -x c++ -I/home/jophish/.nix-profile/lib//../lib/clang/3.7.0/include/ -fsyntax-only -Xclang -code-completion-at=/home/jophish/a.cpp:7:20 /home/jophish/a.cpp
When it should be passing whatever the clang wrapper passes to clang, something like this:
clang --isystem /nix/store/2xrkp6zca9hbmsdjfb3v09dv4awaqyap-gcc-4.9.3/include/c++/4.9.3 -isystem /nix/store/2xrkp6zca9hbmsdjfb3v09dv4awaqyap-gcc-4.9.3/include/c++/4.9.3/x86_64-unknown-linux-gnu -x c++ -I/home/jophish/.nix-profile/lib//../lib/clang/3.7.0/include/ -fsyntax-only -Xclang -code-completion-at=/home/jophish/a.cpp:7:20 /home/jophish/a.cpp
At the moment I don't think there's an easy way to get hold of these paths.
This seems like a more specific case of #238
Years ago system include paths were gathered from compiler output, it would be possible to do the same here (clang -v -x c++ -c -o /dev/null - < /dev/null), but that implementation was ripped off AFAIR to be make it more portable (I'm not sure it ever accomplished this though). The thing is that especially in case of clang, its executable is the only source of those paths. GCC has spec-files and clang hard-codes all the stuff in its code, although in this case it actually guesses those paths, so they couldn't be in any spec-file (or maybe it reads and interprets spec-file of GCC, I don't know).
The clang executable on nix is actually a wrapper
You seem to be referring to a compiler driver. It's always this way (although clang has both driver and compiler in one executable file). The driver is the most high-level part of a compiler responsible for easy-to-use user interface. Nix just places files in non-standard location, so the error occurs, while clang installed into regular location doesn't have such issue.
Not sure if any of the above is helpful, just though I'll clarify what's going on a bit.
The nix guys recommended looking at the output of clang --print-search-dirs
The clang executable on nix is actually a wrapper
You seem to be referring to a compiler driver.
Nope, on nix it's a small script which fiddles with the arguments passed to the real clang executable.