1- # Original implementation: https://github.com/NixOS/nixpkgs/pull/383013
2- # After merging should be in https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb
1+ # Based on https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/default.nix
32{
43 callPackage ,
54 cargo ,
2120} :
2221assert lib . versionAtLeast python3 . version "3.5" ;
2322let
24- supportedVersion = "1.11.8" ;
23+ supportedVersion = "1.12.1" ;
24+ extFullName = "${ mktplcRef . publisher } .${ mktplcRef . name } " ;
2525in
2626assert lib . asserts . assertMsg ( mktplcRef . version == supportedVersion ) ''
27- The version `${ mktplcRef . version } ` of `vadimcn.vscode-lldb ` is not supported.
27+ The version `${ mktplcRef . version } ` of `${ extFullName } ` is not supported.
2828
2929 Only the version `${ supportedVersion } ` is supported.
3030
31- Try `extensions.${ stdenv . hostPlatform . system } .vscode-marketplace-universal.vadimcn.vscode-lldb `
32- or `extensions.${ stdenv . hostPlatform . system } .open-vsx-universal.vadimcn.vscode-lldb `.
31+ Try `extensions.${ stdenv . hostPlatform . system } .vscode-marketplace-universal.${ extFullName } `
32+ or `extensions.${ stdenv . hostPlatform . system } .open-vsx-universal.${ extFullName } `.
3333'' ;
3434let
3535 inherit ( mktplcRef ) publisher version ;
4646
4747 # Get the hash of a source code in a release (https://github.com/vadimcn/codelldb/releases)
4848 #
49- # nix-repl> rev = "1.11.8 "
49+ # nix-repl> rev = "1.12.1 "
5050 # nix-repl> src = pkgs.fetchFromGitHub { owner = "vadimcn"; repo = "codelldb"; rev = "v${rev}"; hash = ""; }
5151 # nix-repl> :b src
5252 #
5353 # Write here the hash that you `got:`.
54- hash = "sha256-mal3hhf+nri8/2Y0wjfBhnMuGVwM3i0JswxT+ttTm7E =" ;
54+ hash = "sha256-B8iCy4NXG7IzJVncbYm5VoAMfhMfxGF+HW7M5sVn5b0 =" ;
5555
5656 # Write here the hash from above.
57- # nix-repl> src = pkgs.fetchFromGitHub { owner = "vadimcn"; repo = "codelldb"; rev = "v${rev}"; hash = "sha256-mal3hhf+nri8/2Y0wjfBhnMuGVwM3i0JswxT+ttTm7E ="; }
57+ # nix-repl> src = pkgs.fetchFromGitHub { owner = "vadimcn"; repo = "codelldb"; rev = "v${rev}"; hash = "sha256-B8iCy4NXG7IzJVncbYm5VoAMfhMfxGF+HW7M5sVn5b0 ="; }
5858
5959 # nix-repl> :b pkgs.rustPlatform.buildRustPackage { cargoHash = ""; name = "dummy"; inherit src; useFetchCargoVendor = true; }
6060 #
6161 # Write here the hash that you `got:`.
62- cargoHash = "sha256-sRqL629+mqvGyNkxpsYd/Kb3AyuysomN0JDR9zKwCO0 =" ;
62+ cargoHash = "sha256-fuUTLdavMiYfpyxctXes2GJCsNZd5g1d4B/v+W/Rnu8 =" ;
6363
6464 # nix-repl> :b pkgs.buildNpmPackage { npmDepsHash = ""; name = "dummy"; inherit src; dontNpmBuild = true; }
6565 #
6666 # Write here the hash that you `got:`.
67- npmDepsHash = "sha256-cS7Fr4mrq0QIPFtG5VjLEOOiC2QuVDW+Ispt2LmI258 =" ;
67+ npmDepsHash = "sha256-TCeIBrlsNuphW2gVsX97+Wu1lOG5gDwS7559YA1d10M =" ;
6868
6969 src = fetchFromGitHub {
7070 owner = "vadimcn" ;
7474 } ;
7575
7676 lldb = llvmPackages_19 . lldb ;
77+ stdenv = llvmPackages_19 . libcxxStdenv ;
7778
7879 adapter = (
7980 callPackage ./adapter.nix {
8081 # The adapter is meant to be compiled with clang++,
8182 # based on the provided CMake toolchain files.
8283 # <https://github.com/vadimcn/codelldb/tree/master/cmake>
8384 rustPlatform = makeRustPlatform {
84- stdenv = llvmPackages_19 . libcxxStdenv ;
85- inherit cargo rustc ;
85+ inherit stdenv cargo rustc ;
8686 } ;
87- stdenv = llvmPackages_19 . libcxxStdenv ;
8887
8988 inherit
9089 pname
9190 src
9291 version
9392 cargoHash
93+ stdenv
9494 ;
9595 }
9696 ) ;
@@ -107,13 +107,31 @@ let
107107 ) ;
108108
109109 codelldb-types = (
110- callPackage ./lldb-types.nix {
110+ callPackage ./codelldb-types.nix {
111+ rustPlatform = makeRustPlatform {
112+ inherit stdenv cargo rustc ;
113+ } ;
114+
115+ inherit
116+ pname
117+ src
118+ version
119+ cargoHash
120+ ;
121+ }
122+ ) ;
123+
124+ codelldb-launch = (
125+ callPackage ./codelldb-launch.nix {
126+ rustPlatform = makeRustPlatform {
127+ inherit stdenv cargo rustc ;
128+ } ;
129+
111130 inherit
112131 pname
113132 src
114133 version
115134 cargoHash
116- nodeDeps
117135 ;
118136 }
119137 ) ;
@@ -132,10 +150,11 @@ lib.customisation.makeOverridable stdenv.mkDerivation {
132150
133151 nativeBuildInputs = [
134152 cmake
135- cargo
136153 makeWrapper
137154 nodejs
138155 unzip
156+ codelldb-types
157+ codelldb-launch
139158 ] ;
140159
141160 patches = [ ./patches/cmake-build-extension-only.patch ] ;
@@ -147,14 +166,6 @@ lib.customisation.makeOverridable stdenv.mkDerivation {
147166
148167 postConfigure = ''
149168 cp -r ${ nodeDeps } /lib/node_modules .
150-
151- # Copy pre-built package.json and generated types from codelldb-types
152- cp ${ codelldb-types } /package.json .
153- mkdir -p generated
154- cp -r ${ codelldb-types } /generated/* generated/
155-
156- # Touch the files to ensure they're newer than dependencies
157- touch package.json generated/codelldb.ts
158169 ''
159170 + lib . optionalString stdenv . hostPlatform . isDarwin ''
160171 export HOME="$TMPDIR/home"
@@ -183,6 +194,11 @@ lib.customisation.makeOverridable stdenv.mkDerivation {
183194 wrapProgram $ext/adapter/codelldb \
184195 --prefix LD_LIBRARY_PATH : "$ext/lldb/lib" \
185196 --set-default LLDB_DEBUGSERVER_PATH "${ adapter . lldbServer } "
197+
198+ # Used by VSCode
199+ mkdir -p $ext/bin
200+ cp ${ codelldb-launch } /bin/codelldb-launch $ext/bin/codelldb-launch
201+
186202 # Mark that all components are installed.
187203 touch $ext/platform.ok
188204
@@ -197,15 +213,15 @@ lib.customisation.makeOverridable stdenv.mkDerivation {
197213 '' ;
198214
199215 passthru = {
200- inherit lldb adapter codelldb-types ;
216+ inherit lldb adapter ;
201217 updateScript = ./update.sh ;
202218 } ;
203219
204220 meta = {
205221 description = "Native debugger extension for VSCode based on LLDB" ;
206222 homepage = "https://github.com/vadimcn/vscode-lldb" ;
207223 license = [ lib . licenses . mit ] ;
208- maintainers = [ lib . maintainers . r4v3n6101 ] ;
224+ maintainers = [ ] ;
209225 platforms = lib . platforms . all ;
210226 } ;
211227}
0 commit comments