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

VSCode server does not respect my default shell setting #579

Open
fyang93 opened this issue Oct 27, 2024 · 2 comments
Open

VSCode server does not respect my default shell setting #579

fyang93 opened this issue Oct 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@fyang93
Copy link

fyang93 commented Oct 27, 2024

Bug description

I adopted option 1 to enable vscode server in wsl. But when I open the terminal in vscode, it goes to sh instead of bash which I actually set as default.
Inside wsl, $SHELL is /run/current-system/sw/bin/bash. However, in vscode, $SHELL becomes /nix/store/sh4d0lnbrapnqjsn1jwb4r07lmwirc8c-sh/bin/sh.

To Reproduce

Steps to reproduce the behavior:
Here is what I set in modules:

nixos-wsl.nixosModules.default
({ pkgs, ...}: {
  system = {
    stateVersion = "24.05";
  };

  programs.nix-ld = {
      enable = true;
      package = pkgs.nix-ld-rs;
  };

  wsl = {
    enable = true;
    useWindowsDriver = true; 
    defaultUser = "${specialArgs.username}";
  };
})

and this is how I set my default shell:

environment.shells = with pkgs; [
  bash
];
users.defaultUserShell = pkgs.bash;

Logs

I don't know if it's related but I printed the $PATH in vscode's integrated terminal anyway.

sh-5.2$ echo $PATH
/home/yang/.vscode-server/bin/384ff7382de624fb94dbaf6da11977bba1ecd427/bin/remote-cli:/usr/lib/wsl/lib/:/home/yang/bin:/home/yang/.local/bin:/run/wrappers/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/home/yang/.nix-profile/bin:/nix/profile/bin:/home/yang/.local/state/nix/profile/bin:/etc/profiles/per-user/yang/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Users/fyang/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/fyang/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/fyang/.dotnet/tools:/nix/store/nswmyag3qi9ars0mxw5lp8zm0wv5zxld-systemd-255.9/bin:/nix/store/3jc4m5gwimj4mbm01ijgkm2di8hiy5l3-gnugrep-3.11/bin:/nix/store/nswmyag3qi9ars0mxw5lp8zm0wv5zxld-systemd-255.9/bin:/nix/store/3jc4m5gwimj4mbm01ijgkm2di8hiy5l3-gnugrep-3.11/bin:/nix/store/nswmyag3qi9ars0mxw5lp8zm0wv5zxld-systemd-255.9/bin:/nix/store/3jc4m5gwimj4mbm01ijgkm2di8hiy5l3-gnugrep-3.11/bin

WSL version

WSL Version: 2.3.24.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.59
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22631.4317
@fyang93 fyang93 added the bug Something isn't working label Oct 27, 2024
@fyang93
Copy link
Author

fyang93 commented Oct 28, 2024

Manually set "terminal.integrated.defaultProfile.linux": "bash" in vscode somehow fix the issue, but does not fundamentally solve it. The $SHELL environment variable remains sh instead of the default shell set in nixos.

@fyang93
Copy link
Author

fyang93 commented Oct 28, 2024

I found a related issue here. It seems that enabling the wsl.warpBinSh option may have caused some problems and needs further attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant