-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Expand file tree
/
Copy pathdefault.nix
More file actions
187 lines (159 loc) · 3.86 KB
/
Copy pathdefault.nix
File metadata and controls
187 lines (159 loc) · 3.86 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
{
callPackage,
cargo,
cmake,
fetchFromGitHub,
lib,
llvmPackages_19,
makeRustPlatform,
makeWrapper,
nodejs,
python3,
rustc,
unzip,
}:
assert lib.versionAtLeast python3.version "3.5";
let
publisher = "vadimcn";
pname = "vscode-lldb";
version = "1.12.1";
vscodeExtUniqueId = "${publisher}.${pname}";
vscodeExtPublisher = publisher;
vscodeExtName = pname;
src = fetchFromGitHub {
owner = "vadimcn";
repo = "codelldb";
rev = "v${version}";
hash = "sha256-B8iCy4NXG7IzJVncbYm5VoAMfhMfxGF+HW7M5sVn5b0=";
};
lldb = llvmPackages_19.lldb;
stdenv = llvmPackages_19.libcxxStdenv;
cargoHash = "sha256-fuUTLdavMiYfpyxctXes2GJCsNZd5g1d4B/v+W/Rnu8=";
adapter = (
callPackage ./adapter.nix {
# The adapter is meant to be compiled with clang++,
# based on the provided CMake toolchain files.
# <https://github.com/vadimcn/codelldb/tree/master/cmake>
rustPlatform = makeRustPlatform {
inherit stdenv cargo rustc;
};
inherit
pname
src
version
stdenv
cargoHash
codelldb-launch
;
}
);
nodeDeps = (
callPackage ./node_deps.nix {
inherit
pname
src
version
;
}
);
codelldb-types = (
callPackage ./codelldb-types.nix {
rustPlatform = makeRustPlatform {
inherit stdenv cargo rustc;
};
inherit
pname
src
version
cargoHash
;
}
);
codelldb-launch = (
callPackage ./codelldb-launch.nix {
rustPlatform = makeRustPlatform {
inherit stdenv cargo rustc;
};
inherit
pname
src
version
cargoHash
;
}
);
in
stdenv.mkDerivation {
pname = "vscode-extension-${publisher}-${pname}";
inherit
src
version
vscodeExtUniqueId
vscodeExtPublisher
vscodeExtName
;
installPrefix = "share/vscode/extensions/${vscodeExtUniqueId}";
nativeBuildInputs = [
cmake
makeWrapper
nodejs
unzip
codelldb-types
codelldb-launch
];
patches = [ ./patches/cmake-build-extension-only.patch ];
# Make devDependencies available to tools/prep-package.js
preConfigure = ''
cp -r ${nodeDeps}/lib/node_modules .
'';
postConfigure = ''
cp -r ${nodeDeps}/lib/node_modules .
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
export HOME="$TMPDIR/home"
mkdir $HOME
'';
cmakeFlags = [
# Do not append timestamp to version.
"-DVERSION_SUFFIX="
];
makeFlags = [ "vsix_bootstrap" ];
preBuild = lib.optionalString stdenv.hostPlatform.isDarwin ''
export HOME=$TMPDIR
'';
installPhase = ''
ext=$out/$installPrefix
runHook preInstall
unzip ./codelldb-bootstrap.vsix 'extension/*' -d ./vsix-extracted
mkdir -p $ext/adapter
mv -t $ext vsix-extracted/extension/*
cp -t $ext/ -r ${adapter}/share/*
wrapProgram $ext/adapter/codelldb \
--prefix LD_LIBRARY_PATH : "$ext/lldb/lib" \
--set-default LLDB_DEBUGSERVER_PATH "${adapter.lldbServer}"
# Used by VSCode
mkdir -p $ext/bin
cp ${codelldb-launch}/bin/codelldb-launch $ext/bin/codelldb-launch
# Mark that all components are installed.
touch $ext/platform.ok
runHook postInstall
'';
# `adapter` will find python binary and libraries at runtime.
postFixup = ''
wrapProgram $out/$installPrefix/adapter/codelldb \
--prefix PATH : "${python3}/bin" \
--prefix LD_LIBRARY_PATH : "${python3}/lib"
'';
passthru = {
inherit lldb;
adapter = adapter.override { standalone = true; };
updateScript = ./update.sh;
};
meta = {
description = "Native debugger extension for VSCode based on LLDB";
homepage = "https://github.com/vadimcn/vscode-lldb";
license = [ lib.licenses.mit ];
maintainers = [ lib.maintainers.r4v3n6101 ];
platforms = lib.platforms.all;
};
}