Use the Nix include dirs and gcc runtime dir, when no sysroot is configured. --- clang/lib/Driver/ToolChains/Linux.cpp 2018-10-05 18:01:15.731109551 +0200 +++ clang/lib/Driver/ToolChains/Linux.cpp 2018-10-05 18:00:27.959509924 +0200 @@ -665,7 +665,7 @@ // Check for configure-time C include directories. StringRef CIncludeDirs(C_INCLUDE_DIRS); - if (CIncludeDirs != "") { + if (CIncludeDirs != "" && (SysRoot.empty() || SysRoot == "/")) { SmallVector dirs; CIncludeDirs.split(dirs, ":"); for (StringRef dir : dirs) { --- clang/lib/Driver/ToolChains/Gnu.cpp 2019-10-26 09:49:27.003752743 +0200 +++ clang/lib/Driver/ToolChains/Gnu.cpp 2019-10-26 09:50:49.067236497 +0200 @@ -1743,7 +1743,7 @@ // If we have a SysRoot, ignore GCC_INSTALL_PREFIX. // GCC_INSTALL_PREFIX specifies the gcc installation for the default // sysroot and is likely not valid with a different sysroot. - if (!SysRoot.empty()) + if (!(SysRoot.empty() || SysRoot == "/")) return ""; return GCC_INSTALL_PREFIX;