Skip to content

Commit 7f915a2

Browse files
committed
nix: fix prebuilt LLVM in dev shell
Add the packages required for prebuilt LLVM to LD_LIBRARY_PATH. Also, switch from `stdenvNoCC` to a proper clang/llvm stdenv.
1 parent dd4ba6e commit 7f915a2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

flake.nix

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
system:
1515
let
1616
pkgs = import nixpkgs { inherit system; };
17+
llvmPackages = pkgs.llvmPackages_21;
18+
mkShell = pkgs.mkShell.override { stdenv = llvmPackages.stdenv; };
1719
in
1820
{
1921
# We want to use Clang instead of GCC because it seems to behave better
2022
# with LLDB, so we use `mkShellNoCC` here instead of `mkShell` because
2123
# the latter brings in GCC by default on Linux.
22-
devShell = pkgs.mkShellNoCC {
24+
devShell = mkShell {
2325
buildInputs = [
2426
# We must list clangd before the `clang` package to make sure it
2527
# comes earlier on the `PATH`, and we must get it from the
@@ -39,10 +41,9 @@
3941
}
4042
])
4143

42-
pkgs.clang
4344
pkgs.cmake
4445
pkgs.gersemi
45-
pkgs.lldb
46+
llvmPackages.lldb
4647
pkgs.ninja
4748
pkgs.nixfmt-rfc-style
4849
pkgs.prettier
@@ -56,6 +57,13 @@
5657
# other than NixOS may require the use of nixGL:
5758
# https://github.com/nix-community/nixGL
5859
pkgs.vulkan-loader
60+
# Needed for the prebuilt LLVM
61+
pkgs.libz
62+
pkgs.zstd
63+
# Despite requiring this packages (slang) to be built with Clang,
64+
# the prebuilt libslang-llvm.so is actually linked against GCC's
65+
# libstdc++.so.6
66+
pkgs.stdenv.cc.cc.lib
5967
];
6068
};
6169
}

0 commit comments

Comments
 (0)