NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.83k stars 13.92k forks source link

VSCode cannot open zsh integrated terminal #181610

Open SnO2WMaN opened 2 years ago

SnO2WMaN commented 2 years ago

Describe the bug

I am using Nix Flake (and home-manager) to manage my laptop and other settings, but after updating the inputs in flake, zsh suddenly stopped running in VSCode's Integrated Terminal after some time has passed. The problem is that zsh does not start in the Integrated Terminal of VSCode. The problem is that no matter what generation of home-manager I rolled back to, I could not solve this problem.

From the screenshot, I think some setting (about permission) in pkgs.vscode is probably wrong, please check it.

Expected behavior

Integrated terminal starts with zsh should be able to open but currently cannot.

Screenshots

2022_07_15__23_03_34

It is possible to start zsh after starting with bash.

2022_07_16__00_51_19

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.18.10, NixOS, 22.11 (Raccoon), 22.11.20220711.38860c9`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.9.1`
 - channels(sno2wman): `"home-manager"`
 - nixpkgs: `/nix/store/dwp21rcg5jq1dx3a1pyfdpa1lwx57wdv-source`

Currently my nixpkgs for pkgs commit rev is github:NixOS/nixpkgs/38860c9e91cb00f4d8cd19c7b4e36c45680c89b5 (nixos-unstable)

SnO2WMaN commented 2 years ago

terminal.integrated.shellIntegration.enabled: false (in JSON) fixed this problem

Enzime commented 2 years ago

VS Code copies the files from the Nix Store which leads to them having no write permissions which means that every time you open a zsh shell it fails by trying to overwrite the existing ones.

https://github.com/microsoft/vscode/blob/1.70.2/src/vs/platform/terminal/node/terminalEnvironment.ts#L192-L195

A fix should be released with the next version of VS Code:

https://github.com/microsoft/vscode/commit/342649329315974bc36d084310ae180f55106505

Hentioe commented 2 years ago

You can temporarily open a terminal by:

  1. Kill the terminal
  2. rm -rf /tmp/vscode-zsh (if you are Linux)
  3. Reopen the terminal (Ctrl + `)

I thought about submitting a patch to vscode to delete the destination file before copying, something like rm -f. Maybe we can also fix file permissions during the build process of nix package.