Skip to content

Commit 8365799

Browse files
committed
fix clangd on darwin
1 parent 2e23063 commit 8365799

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

flake.nix

+7-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
rev = with self; if sourceInfo?dirtyRev then sourceInfo.dirtyRev else sourceInfo.rev;
1414
pkgs = import nixpkgs { inherit system; };
1515

16+
llvmPackages = pkgs.llvmPackages_19;
17+
1618
devShellTools = [
17-
pkgs.clang-tools
19+
llvmPackages.clang-tools
20+
pkgs.git
1821
];
1922

2023
tools = [
@@ -34,14 +37,12 @@
3437
pkgs.capstone
3538
pkgs.dbus
3639
pkgs.bzip2
37-
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
38-
pkgs.darwin.apple_sdk.frameworks.Cocoa
3940
] ++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [
4041
pkgs.qt6.qtbase # TODO: Qt should work on Darwin too
4142
pkgs.qt6.wrapQtAppsHook
4243
];
4344
stdenv = if pkgs.stdenv.isLinux then pkgs.stdenv
44-
else if pkgs.stdenv.isDarwin then pkgs.clang18Stdenv
45+
else if pkgs.stdenv.isDarwin then llvmPackages.stdenv
4546
else throw "Unsupported platform";
4647
in
4748
{
@@ -91,6 +92,8 @@
9192
shellHook = if stdenv.isLinux then ''
9293
export LD_LIBRARY_PATH="${pkgs.vulkan-loader}/lib";
9394
'' else if stdenv.isDarwin then ''
95+
# clangd needs to come from clang-tools. Because Darwin uses clang stdenv, this is the only way to ensure we use the right clangd.
96+
export PATH="${llvmPackages.clang-tools}/bin:$PATH";
9497
export DYLD_FALLBACK_LIBRARY_PATH="${pkgs.darwin.moltenvk}/lib";
9598
'' else throw "Unsupported platform";
9699
};

0 commit comments

Comments
 (0)