vscode-js-debug
vscode-js-debug copied to clipboard
Offline build for NixOS
I am currently trying to create a native vimPlugin implementation for NixOS for vscode-js-debug. Now there are some specifics which make building node related packages pretty hard on NixOS. one is the nature the package.json being non deterministic which goes against the basic principle of the way NixOS operates. Also a package-lock does not guarantee the packages have not been altered (version deleted and republished).
Adding to this principle. NixOS does not allow network access during the build process. This is the tricky part for this one as npx gulp vsDebugServer does rely on internet access.
I am more than happy to provide a PR addressing the issue. However I do lack experience with gulp. So it would help to get some assistance here. I also saw that there is a task called dapDebugServer and was wondering if that would already do the job as it does not seem to include the i10n download nor compile:dynamic which also causes some trouble due tue dynamic linking.
I did find that in the gulpfile.js the l10n bundle download is an example that relies on downloading the zip from a github repo. My suggestion would be that you could set env vars during the build process that specify the location of such files. Would this be a viable option or are there any roadblocks I did not think of that would make an offline build impossible?
Also a package-lock does not guarantee the packages have not been altered (version deleted and republished).
The package-lock does include package checksums which are proof against modification.
My suggestion would be that you could set env vars during the build process that specify the location of such files.
Sure, I would take a PR to add this. If such an environment variable is set we would jsut return early from
https://github.com/microsoft/vscode-js-debug/blob/3ed213faba62916c4d73233bd837a57179b40b2a/gulpfile.js#L356
I am working on this. It is alot of work (and a nice NixOS learning journey). The first concept I might come up with probably would need some improvements. As stated before one of the key differences is that for NixOS to utilize npm packages they need to be "converted" from the package.json to inputs (basically also a package list derived from package.json but one that includes all the content hashes for the packages to ensure that the build process is deterministic)
This requires me to include all the explicit architecture packages as well (so. e.g. in addition to esbuild @esbuild/linux-x64) is also needed.
I don't want the impact on this repo being to big. So just as a heads up. If someone is more experienced with this and has a clever idea on how to minimize the impact that would be great.
Ok. I was able to buld a vimPlugin with NixOS for this. But included some heavy changes and I don't think it is ready for a PR yet as the impact on this repo should be reduced. The good news is it could be done by using the gulp task for the dapDebugServer which does not need an internet connection.
The progress of this as well as the changes I had to do are also in this discussion board
https://discourse.nixos.org/t/vimplugin-for-javascript-debugging-vscode-js-debug-and-nvim-dap-vscode-js/64053
you can find my current fork here https://github.com/relief-melone/vscode-js-debug
unforunately I just forked off main at some point. Will redo the changes on a v1.100.0 version in the coming days. Maybe we can see which changes could be added and which ones need to be kept out of the repo