Replies: 1 comment 8 replies
|
I'm on VSCode 1.66.2 and use msteen/nixos-vscode-server, which works quite well, except for the fact that i have to restart the auto-fix-vscode systemd service once after every vscode update. remote.WSL2.connectionMethod
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello 👋
I have been playing around with VSCode (installed in windows) + the remote WSL extension, and in the process I had to solve some problems. I want to share my findings, and maybe we can find a solution to all of them.
Node binary
When the WSL part of vscode server starts, it will download a pre-compiled
nodebinary from the internet, and try to use it to run the server. This binary doesn't work on NixOS. In the WSL extension logs, you would see something like:/home/nixos/.vscode-server-insiders/bin/ed2619e11b68bec43b788486230b0c2afeb4672d/bin/code-server-insiders: line 12: /home/nixos/.vscode-server-insiders/bin/ed2619e11b68bec43b788486230b0c2afeb4672d/node: No such file or directoryKnown solutions
Manually patching or replacing the binary
One could use the existing nix tooling to patch this binary, or maybe replace it with a symlink into the store.
Automatic patching with the help of
~/.vscode-server/server-env-setupThe
~/.vscode-server/server-env-setuppath can hold a script that the vscode remote extension will run before running the server. In this script we can automate the process of patching the node binary.This is exactly what sonowz/vscode-remote-wsl-nixos does.
nix-ld
As the readme says, this allows you to run unpatched binaries, inlcuding the node binary. For my setup I did a "global" installation, by setting the
NIX_LD_LIBRARY_PATHandNIX_LDenvironment variables system wide. It is quite convenient, because the server just works OOTB, but I can understand that users wouldn't want to enable this globally.Maybe this environment could be set with the help of
~/.vscode-server/server-env-setup, by exporting NIX_LD and NIX_LD_LIBRARY_PATH, altough I haven't tried it myself.remote.WSL2.connectionMethod
I had this error today for the first time, so I suspect vscode changed something in a recent release:
When attaching to WSL, the server would download fine to the distro, but will fail to start, with the error messages:
The logs show:
And, as it says, by using the setting
"remote.WSL2.connectionMethod": "wsl2VMAddress"seems to solve this issue.I don't know if this is a problem with nixos-wsl, or vscode.
~not resolved (running as root)During the initialization of the vscode server, it will call this command:
Upon more investigation, it seems that
~is resolved to the root user. This is not the behaviour in other distros:I don't know if this is a misconfiguration on my side.
Altough vscode seems to ignore this and continue the WSL extension initialisation, I think this should be further investigated.
System details
nixpkgs rev:
cbe587c735b734405f56803e267820ee1559e6c1nixos-wsl rev:
506d46f8b7509080388ab5d3c6daca5a1097f649VSCode 1.67
All reactions