I can manually install extensions using the VS Code UI, which is also fine. But I’d like the setup to be reproducible.
The guide about VS Code on the NixOS wiki (https://nixos.wiki/wiki/Visual_Studio_Code) only mentions configuring extensions in programs.vscode, which doesn’t apply in WSL.
How can I install the extensions so that they’re ready after running home-manager switch?
I know I could probably do it with home.file.".vscode-server/extensions/extensions.json" by putting the whole JSON there, but that would make it hard to update and add new extensions over time.
For now, I just add the extensions to workspace recommendations. Then, when i switch to WSL, it asks me once if i would like to install the recommended extensions in WSL.
Going out of WSL and even when running nixos-rebuild preserves my installed extensions in NixOS, so it’s really a click-once and get over with it. Although i understand it isn’t really a NixOS mindset to do it like this.
You can also set remote.extensionKind in your .vscode/settings.json, to steer your extensions to the workspace (remote) instead of ui, but it doesn’t really help much in this case:
I was looking for a solution for this as well and currently have somewhat of a workaround.
programs.vscode will write settings to ~/config/Code.
Meanwhile when working on WSL, the remote code server will work with settings/extensions in ~/.vscode-server/extensions. So i just symlink them for now: