Skip to content

VSCode server does not respect my default shell setting #579

@fyang93

Description

@fyang93

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions