I use Home Manager to manage my VS Code settings and extensions.
Several of the VS Code extensions I want are not available as NixOS packages, so I use buildVscodeMarketplaceExtension to install them. I declare all my VS Code extensions in this file.
The issue I have with my solution is that it’s really annoying to keep all extensions up to date. Here is what I need to do:
Update the version manually.
Run home-manager switch and wait for it to fail. It fails because the SHA of the new version of a VS Code extension is different from the SHA of the old version of the same extension.
Replace the old SHA with the new SHA.
Repeat 1-3 for each VS Code extension I want to update.
Is there a better, quicker way to keep all my VS Code extensions up to date?
According to its config example, all you have to do is write your extensions in a toml file and specify the place it will get the sources from. For example, here we have an extension from the VS Marketplace and another from the Open VSK:
You will have two files under a _sources directory (you can change it this using the -o <DIR> option):
_sources/generated.nix: Nix expression which will have the latest extension information and which you can use in your system config.
_sources/generated.json: Used to generate update messages.
After this, updating extensions to the latest versions just means re-running the tool again and it will automatically check their current versions with the sources and update them if necessary.
That’s certainly the way to go! But until those packages are in the repos, it’s nice to have a way to automatically check and update everything for you. Plus, it’s also nice for existing extensions to know if updates are available in the first place.
PS: This tool can generate update commits for you, but I don’t know how (or if) it can be integrated with nixpkgs or if there are other tools that already do this. If any of this is possible, please let me know
I had the same issue. The problem wasn’t, particularly, the effort of applying changes - the problem was knowing when there were changes to make.
The maintainer script would go fetch the lastest versions of your installed extensions, but it would print them all, not just the ones needing an update. VScode’s own check-for-updates mechanism was disabled (except for a brief time, which I assume was an accident or config drift mismatch).
I switched to using most, if not quite all, extensions from the auto-generated nix-vscode-extensions flake, and have barely thought about it again since.