Closed boozedog closed 11 months ago
Sorry for the late reply, I was busy IRL :(
It seems like the script was not run in NixOS shell, by looking at your log:
[2023-07-25 19:02:32.179] NIXOS_VERSION detected as ""
[2023-07-25 19:02:32.179] Got vscode directory : /mnt/c/Users/david/AppData/Local/Programs/Microsoft VS Code
where NIXOS_VERSION was not detected, and vscode directory is shown as your Windows directory rather than something like /home/david/.vscode-server
.
Maybe you should try changing WSL2 connection method, located in vscode preference as remote.WSL2.connectionMethod
?
Two things: remote.WSL2.connectionMethod
doesn't seem to be a valid setting anymore, and what connectionMethod
should you use, if I may ask?
I updated WSL extension and was able to reproduce the issue.
There's an issue opened in NixOS-WSL: https://github.com/nix-community/NixOS-WSL/issues/238
You may have noticed that with the latest update to the WSL remote extension (0.77.0), connecting to NixOS fails. This is because Micrsoft removed the option for setting the remote connection method.
remote.WSL2.connectionMethod
setting was removed in 0.77.0, so you should downgrade WSL extension to 0.76.0.
And setting connection method to localhost
works for me. Hope it helps!
I'll try that; thanks!
I stumbled upon this issue again after I updated NixOS-WSL version to 23.5.5.2.
It turned out that actually uname
, cut
, nixos-version
, dirname
, nix
commands were not available on shell path. So I added what was needed to PATH
envvar, and after this commit(https://github.com/sonowz/vscode-remote-wsl-nixos/commit/b8f59ee7839d00a3123c84ebe682318c023377fe) it works. If you're using the latest NixOS-WSL release, please give it a try.
I'm supossing that the fix would solve the "command not found" error for the most cases, so I'll close this issue for now. If you find that the issue persists, please give me more details about your environment so that we can figure out the root cause.
Remote WSL works fine with WSL Debian on my system.
I've got nixos-unstable running in WSL2 with flakes. I am able to connect using Windows terminal and things work as expected.
uname
,wget
,nixos-version
, etc all work fine.However, when I try to connect using remote WSL in VS Code, it fails with the output below.