Vscode with extensions and settings using home-manager

Has anyone got an example of using vscode with extensions and settings using home-manager?

vscode-with-extensions doesn’t include settings as far as I could see, so I thought I’d try home manager’s vscode but for some reason it doesn’t seem to be linking code.

Would love it if someone could share their config (via github?)?

(I’m wondering is if there’s a way to consolidate all our configs so that we could search through all the nix examples that people have. Hmm, maybe a git repo with many submodules… I really need to see lots of examples of how other people nix.)

1 Like

I must have an example in here:

So thomashoneyman’s configuration was great starter for vscode in home manager and this script is excellent: nixpkgs/update_installed_exts.sh at 42d815d1026e57f7e6f178de5a280c14f7aba1a5 · NixOS/nixpkgs · GitHub

(though I did remove the error handling because I didn’t want it to stop if it got a 404)

But for extensions like CodeLLDB that try and download a native extension they trip over everything being read only. Not sure what the nicest way to handle that is. Maybe they need to be specifically repackaged? I’m not sure I can see any alternative…

This would all just work if the extensions dir wasn’t a read only file system…

1 Like

Same kind of issues here, i get

Error: EROFS: read-only file system, open '/home/jlucas/.config/Code/User/settings.json'


EROFS: read-only file system, open '/nix/store/ligj18a3amxv34fb9hliklcp8jahnb03-vscode-extensions-1.41.0/share/vscode/extensions/alanz.vscode-hie-server/package.json'

while trying to follow this tutorial Tuto fonctionnel : Configure VSCode for Haskell (Debian/Nix/NixOS)

if it was mutable, then it wouldn’t be reproducible


settings are through the userSettings attr set:

           Configuration written to Visual Studio Code's settings.json.

           Type: attribute set

           Default: { }


                 "update.channel" = "none";
                 "[nix]"."editor.tabSize" = 2;
1 Like

Having used it for a while now I really don’t think locking down settings.json is a great idea. It would be better to pull in a settings file from somewhere else, but for now I’ve just wrapped my settings as an extension which then sets them on startup if they’re not already set. ( It’s called correct.defaults ). That way I have some canned settings and I am also free to tinker.

The extensions works well with home manager using this script to capture the ones I like:

Now if I could only get codelldb to behave I’d be in a good place.

Could you share us your corrects.defaults extenstion please? I have the same problem.