Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help needed #9

Open
azegas opened this issue Sep 4, 2024 · 2 comments
Open

Help needed #9

azegas opened this issue Sep 4, 2024 · 2 comments

Comments

@azegas
Copy link

azegas commented Sep 4, 2024

Hey!

I could use Ubuntu distro to open VsCode in, it works perfectly right out of the box, but I want to make it work wiht NixOS too!!

My nixos config currently lies here - /etc/nixos/configuration.nix

I also did this step cp ./server-env-setup ~/.vscode-server/server-env-setup as you can see (used non-flakes/server-env-setup, since I don't use/know how to use flakes):

image

What happens when I try to connect VsCode to NixOS WSL distro:

image

Full error message from VsCode (that you can see in the image above):

[2024-09-04 10:55:24.720] Extension version: 0.88.2
[2024-09-04 10:55:24.720] L10N bundle: undefined
[2024-09-04 10:55:24.771] authorityHierarchy: wsl+NixOS
[2024-09-04 10:55:24.771] WSL extension activating for a local WSL instance
[2024-09-04 10:55:24.778] Resolving wsl+NixOS, resolveAttempt: 1
[2024-09-04 10:55:24.779] NodeExecServer run: C:\WINDOWS\System32\wsl.exe --status
[2024-09-04 10:55:24.863] WSL feature installed: true (wsl --status)
[2024-09-04 10:55:24.864] NodeExecServer run: C:\WINDOWS\System32\wsl.exe --list --verbose
[2024-09-04 10:55:24.923] 4 distros found
[2024-09-04 10:55:24.924] Starting VS Code Server inside WSL (wsl2)
[2024-09-04 10:55:24.924] Windows build: 22631. Multi distro support: available. WSL path support: enabled
[2024-09-04 10:55:24.925] Scriptless setup: false
[2024-09-04 10:55:24.926] No shell environment set or found for current distro.
[2024-09-04 10:55:25.066] WSL daemon log file: 
[2024-09-04 10:55:25.069] Probing if server is already installed: if [ -d ~/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573 ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf 'alpine-'; fi; if [ -s ~/.vscode-server/bin/compatibilty-check ]; then printf 'legacy-'; fi; uname -m;
[2024-09-04 10:55:25.069] NodeExecServer run: C:\WINDOWS\System32\wsl.exe -d NixOS -e sh -c if [ -d ~/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573 ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf 'alpine-'; fi; if [ -s ~/.vscode-server/bin/compatibilty-check ]; then printf 'legacy-'; fi; uname -m;
[2024-09-04 10:55:25.299] Unable to detect if server is already installed: Error: Failed to probe if server is already installed: code: Failed to probe if server is already installed: code: 127, /nix/store/qddh95vjifqqlvby19maszcapnm3jkhk-bash-interactive-5.2-p15/bin/sh: line 1: uname: command not found
[2024-09-04 10:55:25.299] , install-found legacy-
[2024-09-04 10:55:25.299] NodeExecServer run: C:\WINDOWS\System32\wsl.exe -d NixOS sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 89de5a8d4d6205e5b11647eb6a74844ca23d2573 stable code-server .vscode-server --host=127.0.0.1 --port=0 --connection-token=1937155211-3634545123-3025406756-1623024966 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all'
[2024-09-04 10:55:25.614] Setting up server environment: Looking for /home/nixos/.vscode-server/server-env-setup. Found, executing...
[2024-09-04 10:55:25.614] == '~/.vscode-server/server-env-setup' SCRIPT START ==
[2024-09-04 10:55:25.614] Got vscode directory : /home/nixos/.vscode-server
[2024-09-04 10:55:25.614] If the directory is incorrect, you can hardcode it on the script.
[2024-09-04 10:55:25.614] Patching nodejs binaries...
[2024-09-04 10:55:27.155] Patching /home/nixos/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573/node
[2024-09-04 10:55:27.460] error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
[2024-09-04 10:55:27.460] patchelf: getting info about '/home/nixos/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573/node_modules/node-pty/build/Release/spawn-helper': No such file or directory
[2024-09-04 10:55:27.460] error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
[2024-09-04 10:55:27.950] == '~/.vscode-server/server-env-setup' SCRIPT END ==
[2024-09-04 10:55:27.950] WSL version: 5.15.153.1-microsoft-standard-WSL2 NixOS
[2024-09-04 10:55:27.950] WSL-shell-PID: 3108
[2024-09-04 10:55:27.950] Node executable: /home/nixos/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573/node
[2024-09-04 10:55:27.950] Starting server: /home/nixos/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573/bin/code-server --host=127.0.0.1 --port=0 --connection-token=1937155211-3634545123-3025406756-1623024966 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all
[2024-09-04 10:55:27.953] /home/nixos/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573/node: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
[2024-09-04 10:55:27.954] For help with startup problems, go to https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
[2024-09-04 10:55:27.958] NodeExecServer run: C:\WINDOWS\System32\wsl.exe -d NixOS -e kill 3108
[2024-09-04 10:55:52.746] Download in background is enabled
[2024-09-04 10:56:22.757] Update check by another window detected, skipping.

What am I doing wrong? :s

Thank you!

@azegas
Copy link
Author

azegas commented Sep 4, 2024

I then found this message in the error:

error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override

so I added this to my nixos configuration:

nix.extraOptions = ''
    experimental-features = nix-command flakes
  '';

and I did rebuild-switch.

When I tried to connect VsCode to NixOS WSL distro once again, I came to a different error message:

[2024-09-04 11:18:24.001] Extension version: 0.88.2
[2024-09-04 11:18:24.001] L10N bundle: undefined
[2024-09-04 11:18:24.056] authorityHierarchy: wsl+NixOS
[2024-09-04 11:18:24.056] WSL extension activating for a local WSL instance
[2024-09-04 11:18:24.066] Resolving wsl+NixOS, resolveAttempt: 1
[2024-09-04 11:18:24.066] NodeExecServer run: C:\WINDOWS\System32\wsl.exe --status
[2024-09-04 11:18:24.127] WSL feature installed: true (wsl --status)
[2024-09-04 11:18:24.128] NodeExecServer run: C:\WINDOWS\System32\wsl.exe --list --verbose
[2024-09-04 11:18:24.192] 4 distros found
[2024-09-04 11:18:24.193] Starting VS Code Server inside WSL (wsl2)
[2024-09-04 11:18:24.193] Windows build: 22631. Multi distro support: available. WSL path support: enabled
[2024-09-04 11:18:24.193] Scriptless setup: false
[2024-09-04 11:18:24.194] No shell environment set or found for current distro.
[2024-09-04 11:18:24.327] WSL daemon log file: 
[2024-09-04 11:18:24.333] Probing if server is already installed: if [ -d ~/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573 ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf 'alpine-'; fi; if [ -s ~/.vscode-server/bin/compatibilty-check ]; then printf 'legacy-'; fi; uname -m;
[2024-09-04 11:18:24.333] NodeExecServer run: C:\WINDOWS\System32\wsl.exe -d NixOS -e sh -c if [ -d ~/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573 ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf 'alpine-'; fi; if [ -s ~/.vscode-server/bin/compatibilty-check ]; then printf 'legacy-'; fi; uname -m;
[2024-09-04 11:18:24.529] Unable to detect if server is already installed: Error: Failed to probe if server is already installed: code: Failed to probe if server is already installed: code: 127, /nix/store/qddh95vjifqqlvby19maszcapnm3jkhk-bash-interactive-5.2-p15/bin/sh: line 1: uname: command not found
[2024-09-04 11:18:24.529] , install-found legacy-
[2024-09-04 11:18:24.531] NodeExecServer run: C:\WINDOWS\System32\wsl.exe -d NixOS sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 89de5a8d4d6205e5b11647eb6a74844ca23d2573 stable code-server .vscode-server --host=127.0.0.1 --port=0 --connection-token=896174925-43756493-2359005707-3392768951 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all'
[2024-09-04 11:18:24.853] Setting up server environment: Looking for /home/nixos/.vscode-server/server-env-setup. Found, executing...
[2024-09-04 11:18:24.853] == '~/.vscode-server/server-env-setup' SCRIPT START ==
[2024-09-04 11:18:24.853] Got vscode directory : /home/nixos/.vscode-server
[2024-09-04 11:18:24.853] If the directory is incorrect, you can hardcode it on the script.
[2024-09-04 11:18:24.853] Patching nodejs binaries...
[2024-09-04 11:18:25.768] Patching /home/nixos/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573/node
[2024-09-04 11:18:25.769] path '/mnt/c/Users/arvydas/AppData/Local/Programs/Microsoft VS Code/nixpkgs.stdenv.cc.cc.lib' does not contain a 'flake.nix', searching up
[2024-09-04 11:18:25.769] error: getting status of '/mnt/c/Users/arvydas/AppData/Local/Programs/Microsoft VS Code/nixpkgs.stdenv.cc.cc.lib': No such file or directory
[2024-09-04 11:18:25.769] patchelf: getting info about '/home/nixos/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573/node_modules/node-pty/build/Release/spawn-helper': No such file or directory
[2024-09-04 11:18:25.769] path '/mnt/c/Users/arvydas/AppData/Local/Programs/Microsoft VS Code/nixpkgs.stdenv.cc.cc.lib' does not contain a 'flake.nix', searching up
[2024-09-04 11:18:25.769] error: getting status of '/mnt/c/Users/arvydas/AppData/Local/Programs/Microsoft VS Code/nixpkgs.stdenv.cc.cc.lib': No such file or directory
[2024-09-04 11:18:26.069] == '~/.vscode-server/server-env-setup' SCRIPT END ==
[2024-09-04 11:18:26.069] WSL version: 5.15.153.1-microsoft-standard-WSL2 NixOS
[2024-09-04 11:18:26.113] WSL-shell-PID: 7425
[2024-09-04 11:18:26.113] Node executable: /home/nixos/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573/node
[2024-09-04 11:18:26.113] Starting server: /home/nixos/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573/bin/code-server --host=127.0.0.1 --port=0 --connection-token=896174925-43756493-2359005707-3392768951 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all
[2024-09-04 11:18:26.114] /home/nixos/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573/node: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
[2024-09-04 11:18:26.114] For help with startup problems, go to https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
[2024-09-04 11:18:26.116] NodeExecServer run: C:\WINDOWS\System32\wsl.exe -d NixOS -e kill 7425
[2024-09-04 11:18:41.955] Download in background is enabled
[2024-09-04 11:19:11.970] Update check by another window detected, skipping.

@sonowz
Copy link
Owner

sonowz commented Sep 17, 2024

Since you enabled flakes by this configuration:

nix.extraOptions = ''
    experimental-features = nix-command flakes
  '';

could you try using flake version script rather than non-flake version? Non-flake version has not been tested for a long time :(

I'll look on non-flake version when I can (maybe after two weeks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants