From 766e718f6739e9098d18674bd71cb0f4bc5bbf43 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Thu, 6 Jun 2024 12:48:13 -0600 Subject: devshells: only enable pch for clang clangd seems to break if GCC is using precompiled headers for C++'s standard library, so this sets -Denable-pch-std=${stdenv.cc.isClang} Fixes #374. Change-Id: Ic4be41ebe7576ebcb9c208275596f953c2003109 --- package.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/package.nix b/package.nix index 43b709023..ec51a9530 100644 --- a/package.nix +++ b/package.nix @@ -424,9 +424,14 @@ stdenv.mkDerivation (finalAttrs: { # For Meson to find Boost. env = finalAttrs.env; - # I guess this is necessary because mesonFlags to mkDerivation doesn't propagate in inputsFrom, - # which only propagates stuff set in hooks? idk. - inherit (finalAttrs) mesonFlags; + mesonFlags = + # I guess this is necessary because mesonFlags to mkDerivation doesn't propagate in inputsFrom, + # which only propagates stuff set in hooks? idk. + finalAttrs.mesonFlags + # Clangd breaks when GCC is using precompiled headers, so for the devshell specifically + # we make precompiled C++ stdlib conditional on using Clang. + # https://git.lix.systems/lix-project/lix/issues/374 + ++ [ (lib.mesonBool "enable-pch-std" stdenv.cc.isClang) ]; packages = lib.optional (stdenv.cc.isClang && hostPlatform == buildPlatform) clang-tools_llvm -- cgit v1.2.3