Best way to keep VS Code extensions up to date?

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:

  1. Update the version manually.
  2. 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.
  3. Replace the old SHA with the new SHA.
  4. 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?

1 Like

How about using nvfetcher?

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:

# nvfetcherExample.toml

src.vsmarketplace = "ms-python.python"
fetch.vsmarketplace = "ms-python.python"

src.openvsx = "llvm-vs-code-extensions.vscode-clangd"
fetch.openvsx = "llvm-vs-code-extensions.vscode-clangd"

You can find the list of sources to check from here.

After you have all your extensions ready, just run the tool:

$ nix-shell -p nvfetcher
$ nvfetcher -c nvfetcherExample.toml

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.

How about just submitting the updates in nixpkgs directly? (Like I do most of the time!)

1 Like

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 :smile:

Cool, I wasn’t aware of nvfetcher. Thanks!

1 Like

nvfetcher is pretty cool. Alternatively you could use GitHub - nix-community/nix-vscode-extensions: Nix expressions for VSCode and OpenVSX extensions [maintainers: @deemp, @AmeerTaweel]. Of course, it is a different approach but maybe valid for you.


This looks awesome, thanks! It’s a better solution in my opinion.

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.


The easiest way is to let vscode update them. Using nix to manage them usually turns out in a hassle and lots of codegen.