How to fix VS Code remote SSH for NixOS target
When you install VS Code with its remote-SSH plugin, and logs into a shell via SSH. VS Code will install its backend on the remote machine (at ~/.vscode-server) and turns the client into a front-end (after all, it’s just an Electron app).
However, VS Code depends on an much older version of nodejs, and so you need to manually relink the node exectubale to that version. In other words:
- Install
nodejs-12_xvia nix-env or home-manager rm -fthenodeexecutable in./vscode-server/bin/<hash>/node- Replace it with symlink
nix eval nixpkgs.nodejs-12_x.outPath
References
- Github issue #648 in 2019
- Github issue #3476 in Aug 2020