Vscode extensions: cake + eat

I’ve been struggling with how to be happy with vscode extensions. I want home-manager to install vscode + a bunch of extensions but I want the freedom to add more. (I’ve decided that allowing home manager to manage the vscode settings is a bad idea - I need them mutable.)

(Let’s be honest here: not using nix installed extensions for extensions with native components is not pleasant. So I really do want to find this half-way house)

vscode has a system extensions dir that allow extensions to be added in there (vscode itself is mostly a set of extensions). If we could add our vscode extensions there then we could add / remove user ones ourselves and be happy. Given MS doesn’t prioritize implementing any form of global extensions or settings, this for a while could be as good as it gets.

sudo code --extensions-dir /usr/share/code/resources/app/extensions
 --user-data-dir </path/to/a/users/homefolder/.vscode/>

Has anyone already attempted this? I’m wondering what I might need to override in an extension to get it to install to the system extensions dir.

the .withExtension wrapper already does that

The problem is that you can’t use more than one extension dir
https://github.com/Microsoft/vscode/issues/3884

1 Like

I just want to say that coming back from a year or two off, nixos seems to have solved this extension contention problem nicely. Very impressed.