-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.nix
More file actions
79 lines (65 loc) · 2.02 KB
/
Copy pathshell.nix
File metadata and controls
79 lines (65 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{ pkgs ? import <nixpkgs> {} }:
let
gccPkg = pkgs.gcc-unwrapped;
gccVersion = gccPkg.version;
gccStorePath = gccPkg;
stdcxxIncludeDir = "${gccStorePath}/include/c++/${gccVersion}";
stdcxxArchIncludeDir = "${stdcxxIncludeDir}/${pkgs.stdenv.hostPlatform.config}";
clangBuiltins = "${pkgs.llvmPackages.clang-unwrapped.lib}/lib/clang/19/include";
in
pkgs.mkShell {
name = "osusat-generator";
buildInputs = with pkgs; [
python313Packages.pyyaml
python313Packages.crccheck
pyright
clang
clang-tools
llvmPackages_latest.lldb
llvmPackages_latest.libllvm
gcc-unwrapped
];
shellHook = ''
# set CLANGD_PATH for editor tooling to use the Nix-wrapped clangd
export CLANGD_PATH="${pkgs.clang-tools}/bin/clangd"
CLANGD_CONFIG_FILE=".clangd"
if [[ ! -d "${stdcxxIncludeDir}" ]]; then
echo "❌ ERROR: GCC C++ headers not found at ${stdcxxIncludeDir}"
find /nix/store -name "c++" -type d 2>/dev/null | head -5
fi
if [[ ! -d "${clangBuiltins}" ]]; then
echo "❌ ERROR: Clang built-ins not found at ${clangBuiltins}"
find /nix/store -path "*/clang/*/include" -type d 2>/dev/null | head -5
fi
if [[ -x "$CLANGD_PATH" ]]; then
echo "✅ CLANGD found at: $CLANGD_PATH"
else
echo "❌ ERROR: CLANGD not found at: $CLANGD_PATH"
fi
echo "📁 Project root: $(pwd)"
echo "📁 Include directory: $(pwd)/c/include"
echo "📁 Checking if include dir exists: $(ls -la c/include/ 2>/dev/null || echo 'NOT FOUND')"
cat > $CLANGD_CONFIG_FILE <<EOF
CompileFlags:
Add:
- "-I$(pwd)/c/include"
- "-I$(pwd)/cpp/include"
Index:
Background: Build
---
If:
PathMatch: .*\.c$
CompileFlags:
Add:
- "-std=c11"
---
If:
PathMatch: .*\.(cpp|cxx|cc|hpp|hxx)$
CompileFlags:
Add:
- "-std=c++14"
EOF
echo "✅ Generated .clangd config:"
cat $CLANGD_CONFIG_FILE
'';
}