Skip to content

nix-community/nix-vscode-extensions

Repository files navigation

Nix expressions for VS Code Extensions

As of October 2, 2025, the nixpkgs repository contains 456 VS Code extensions. This is a small fraction of the nearly 80,000 extensions available on the VS Code Marketplace. In addition, many of the extensions in nixpkgs are outdated.

This flake provides Nix expressions for the latest pre-release and release versions of the majority of available extensions from the VS Code Marketplace and the Open VSX Registry. A GitHub Action updates these extensions daily.

Important

Don't abuse this flake

We have a permission from MS to use a crawler on their API (see the discussion).

Don't abuse this flake!

nix4vscode

Check nix4vscode (and contribute!) if you need more extension versions.

Prerequisites

Read NixOS wiki

Read the VS Code page on the NixOS wiki.

(Optional) Enable flakes and experimental commands

(Optional) Allow unfree packages

See Unfree extensions.

(Optional) Enter the repository directory

Clone this repository and enter its directory.

git clone https://github.com/nix-community/nix-vscode-extensions
cd nix-vscode-extensions

(Optional) Start REPL

See nix repl.

nix repl

(Optional) Get your system

system="$(nix-instantiate --eval --expr "builtins.currentSystem")"

On my system:

printf "$system"
"x86_64-linux"

Note

You can use the value that you got on your machine instead of builtins.currentSystem in instructions below.

History

You can search for an extension in the repository history:

  • Get commits containing the extension: git log -S '"copilot"' --oneline data/cache/vscode-marketplace-latest.json
  • Select a commit, e.g.: 0910d1e
  • Search in that commit: git grep '"copilot"' 0910d1e -- data/cache/vscode-marketplace-latest.json

Example

The ./nix/vscode-with-extensions.nix provides an example of vscode-with-extensions.

This package is VS Code with a couple of extensions.

Run VS Code and list installed extensions.

List extensions with flakes

nix run github:nix-community/nix-vscode-extensions/fd5c5549692ff4d2dbee1ab7eea19adc2f97baeb#default -- --list-extensions

Template

This repository has a flake template.

This template provides a VSCodium with a couple of extensions.

  1. Create a flake from the template (see nix flake new).

    nix flake new vscodium-project -t github:nix-community/nix-vscode-extensions
    cd vscodium-project
    git init && git add .
  2. Run VSCodium.

    nix run .# .
  3. Alternatively, start a devShell and run VSCodium. A shellHook will print extensions available in the VSCodium.

    nix develop .#vscodium
    codium .

In case of problems see Troubleshooting.

Overlay

See Overlays.

If you use NixOS, Home Manager, or similar:

  1. If you use flakes, add nix-vscode-extensions to your flake inputs (see example).

    inputs.nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions/fd5c5549692ff4d2dbee1ab7eea19adc2f97baeb";
    outputs = inputs@{ nix-vscode-extensions, ... }: ...
  2. If you don't use flakes, import the nix-vscode-extensions repository.

    let
      nix-vscode-extensions = import (
        builtins.fetchGit {
          url = "https://github.com/nix-community/nix-vscode-extensions";
          ref = "refs/heads/master";
          rev = "fd5c5549692ff4d2dbee1ab7eea19adc2f97baeb";
        }
      );
    in
  3. Add the nix-vscode-extensions.overlays.default to nixpkgs overlays (see Get extensions via the overlay, example).

  4. (Optional) Allow unfree packages (see Unfree extensions).

  5. Use pkgs.nix-vscode-extensions.vscode-marketplace, pkgs.nix-vscode-extensions.open-vsx and others (see The extensions attrset, Explore, example).

Note

See With-expressions.

In with A; with B;, the attributes of B shadow the attributes of A.

Keep in mind this property of with when writing with vscode-marketplace; with vscode-marketplace-release;.

Get extensions

Prerequisites

Get nixpkgs

Get nixpkgs with flakes

nix-repl> nixpkgs = builtins.getFlake github:NixOS/nixpkgs/674c2b09c59a220204350ced584cadaacee30038

Get nixpkgs without flakes

nix-repl> nixpkgs = (import (builtins.fetchGit {
            url = "https://github.com/NixOS/nixpkgs";
            ref = "refs/heads/master";
            rev = "674c2b09c59a220204350ced584cadaacee30038";
          }))

Get nix-vscode-extensions

Get nix-vscode-extensions with flakes

nix-repl> nix-vscode-extensions = builtins.getFlake github:nix-community/nix-vscode-extensions/fd5c5549692ff4d2dbee1ab7eea19adc2f97baeb

Get nix-vscode-extensions without flakes

nix-repl> nix-vscode-extensions = (import (builtins.fetchGit {
            url = "https://github.com/nix-community/nix-vscode-extensions";
            ref = "refs/heads/master";
            rev = "fd5c5549692ff4d2dbee1ab7eea19adc2f97baeb";
          }))

Get extensions via the overlay

nix-repl> extensions = (import nixpkgs { system = builtins.currentSystem; config.allowUnfree = true; overlays = [ nix-vscode-extensions.overlays.default ]; }).nix-vscode-extensions

Get extensions from nix-vscode-extensions

nix-repl> extensions = nix-vscode-extensions.extensions.${builtins.currentSystem}

Extensions

Platforms

We provide attrsets that contain both universal and platform-specific extensions.

We use a reasonable mapping between the sites target platforms and Nix-supported platforms (see systemPlatform in flake.nix, issue).

The extensions attrset

Note

Here, * stands for a sequence of zero or more characters.

The Get extensions section explains how to get the extensions attrset.

This attrset contains several attributes described in the sections Extension attrsets and Functions that produce extension attrsets.

Extension attrsets

We have no reliable way to choose the semantically latest cached version of an extension (see cache files).

Therefore, we used the following method:

  1. We chose properties of extension versions that may predict whether a version is the latest one:
    • whether a version is pre-release or release;
    • whether a version is universal or platform-specific.
  2. We prioritized all combinations of property values.
  3. We created several attrsets of extensions with constraints on possible combinations of property values.
  4. We named attrsets to show additional constraints. E.g., vscode-marketplace* attrsets contain only extensions from the VS Code Marketplace.
  5. In each attrset, for each extension whose versions could be in that attrset, we provided a single highest-priority version of that extension.

The next sections show permitted property combinations and their priorities in corresponding attrsets.

vscode-marketplace and open-vsx

  1. pre-release platform-specific
  2. pre-release universal
  3. release platform-specific
  4. release universal

vscode-marketplace-release and open-vsx-release

  1. release platform-specific
  2. release universal

vscode-marketplace-universal and open-vsx-universal

  1. pre-release universal
  2. release universal

vscode-marketplace-release-universal and open-vsx-release-universal

  1. release universal

Functions that produce extension attrsets

forVSCodeVersion

forVSCodeVersion version produces an attrset similar to extensions (see The extensions attrset) but containing only the extensions compatible with the version version of VS Code (see Versions compatible with a given version of VS Code).

You should replace version with your VS Code or VSCodium version.

usingFixesFrom

usingFixesFrom nixpkgsWithFixes produces an attrset where particular extensions have fixes specified in the supplied nixpkgsWithFixes (see mkExtensionNixpkgs in mkExtension.nix, Versions with fixes from particular nixpkgs, Use fixes from nixpkgs).

  • The supplied nixpkgsWithFixes can be any version of nixpkgs (see Get nixpkgs).
  • The supplied nixpkgsWithFixes is used only to look up the fixes in its source code and is independent of the nixpkgs that you apply the overlay to.

The top-level vscode-marketplace* and open-vsx* attributes are constructed using fixes from nixpkgs that you apply the overlay to (if you get extensions via the overlay) or nixpkgs from the nix-vscode-extensions repository (if you get extensions from nix-vscode-extensions).

Extension identifiers

  • Extension publishers and names are lowercased only in Nix.
  • Access an extension in the format <attrset>.<publisher>.<name>, where <attrset> is vscode-marketplace, open-vsx, etc. (see Explore).
  • If an extension publisher or name aren't valid Nix identifiers, quote them like <attrset>."4"."2".

Missing extensions

  • Some previously available extensions may be unavailable in newer versions of this flake.
    • An extension is missing if it doesn't appear during a particular workflow run in a VS Code Marketplace or an Open VSX response about the full set of available extensions (see discussion).
    • We let missing extensions remain in cache files and plan to purge missing extensions periodically (see #139).

Extension packs

  • We don't automatically handle extension packs. You should look up extensions in a pack and explicitly write all necessary extensions.

Unfree extensions

  • We use derivations and code from nixpkgs for some extensions (see Versions with fixes from particular nixpkgs).
  • Unfree extensions from nixpkgs stay unfree here (see Unfree software, Special extensions).
  • If you want to use unfree extensions, try one of the following ways:
    • Installing unfree packages.

    • Global configuration - Example.

    • Set config.allowUnfree = true when constructing pkgs.

      pkgs = import nixpkgs {
        system = builtins.currentSystem;
        config.allowUnfree = true;
        overlays = [ overlays.default ];
      }
    • Override the license of a particular extension.

      let
        resetLicense =
          drv:
          drv.overrideAttrs (prev: {
            meta = prev.meta // {
              license = [ ];
            };
          });
      in
      resetLicense <publisher>.<name>

Explore

Prerequisites

Note

Press the Tab button (denoted as <TAB> below) to see attrset attributes.

Explore extensions

nix-repl> extensions.<TAB>
extensions.forVSCodeVersion                      extensions.vscode-marketplace
extensions.open-vsx                              extensions.vscode-marketplace-release
extensions.open-vsx-release                      extensions.vscode-marketplace-release-universal
extensions.open-vsx-release-universal            extensions.vscode-marketplace-universal
extensions.open-vsx-universal
extensions.usingFixesFrom

Explore vscode-marketplace and open-vsx

See vscode-marketplace and open-vsx.

nix-repl> extensions.vscode-marketplace.rust-lang.rust-analyzer.version
"0.4.2638"
nix-repl> extensions.vscode-marketplace.vadimcn.vscode-lldb.version
"1.11.0"

Explore vscode-marketplace-release and open-vsx-release

See vscode-marketplace-release and open-vsx-release.

nix-repl> extensions.vscode-marketplace-release.rust-lang.rust-analyzer.version
"0.3.2593"
nix-repl> extensions.vscode-marketplace-release.vadimcn.vscode-lldb.version
"1.11.0"

Explore vscode-marketplace-universal and open-vsx-universal

See vscode-marketplace-universal and open-vsx-universal.

nix-repl> extensions.vscode-marketplace-universal.rust-lang.rust-analyzer.version
"0.4.1067"
nix-repl> extensions.vscode-marketplace-universal.vadimcn.vscode-lldb.version
"1.11.6"

Explore vscode-marketplace-release-universal and open-vsx-release-universal

See vscode-marketplace-release-universal and open-vsx-release-universal.

nix-repl> extensions.vscode-marketplace-release-universal.vadimcn.vscode-lldb.version
"1.11.6"

Versions compatible with a given version of VS Code

See forVSCodeVersion.

nix-repl> extensionsCompatible = extensions.forVSCodeVersion "1.78.2"

The extensionsCompatible attrset contains some of the the extensions attrset attributes.

Versions with fixes from particular nixpkgs

Some extensions require non-trivial fixes (example).

These fixes may be available in a particular version of nixpkgs.

These fixes are read from the source code of that nixpkgs version (see mkExtensionNixpkgs in mkExtension.nix).

Use fixes from nixpkgs

Get extensions.

In this case, we use the same version of nixpkgs that was used to get extensions. You can use any other version instead.

nix-repl> extensionsFixed = extensions.usingFixesFrom nixpkgs

The extensionsFixed attrset contains some of the the extensions attrset attributes.

Removed extensions

Some extensions are unavailable or don't work on particular platforms.

These extensions are disabled via removed.nix.

Config

See:

Cache

Cache files

See:

Cache object example

{
  "p": "haskell",
  "n": "haskell",
  "r": 0,
  "P": 0,
  "v": "2.7.0",
  "e": "^1.102.0",
  "m": 2,
  "h": "sha256-rkQw8A2irw1AcUCnEffG5BNPuQQF9dfjiRHHXPdK/zU="
}

Intermediate Nix representation

JSON key Nix attrname Description
p publisher extension publisher
n name extension name
r isRelease whether it's a release extension version
P platform extension platform
v version extension version
e engineVersion engine version (minimal compatible VSCode version)
h hash extension .vsix hash obtained via nix store prefetch-file

Values

In the ./flake.nix:

  • numberToPlatform converts P to platform;
  • numberToIsRelease converts r to isRelease.

Nix

mkExtension.nix

./nix/mkExtension.nix provides a function to build an extension from an extension config.

Contribute

Issues

Resolve issues.

Pull requests

Make pull requests.

README

  • Fix links.
  • Write new sections.
  • Update commit hashes used in examples if they're too old.
  • Enhance the text.

Extra extensions

The extra-extensions.toml file contains a list of extensions to be fetched from sites other than VS Code Marketplace and Open VSX. These extensions replace ones fetched from VS Code Marketplace and Open VSX. Add necessary extensions there, preferrably, for all supported platforms (see Extensions). nvfetcher will fetch the latest release versions of these extensions and write configs to generated.nix.

Special extensions

Certain extensions require special treatment.

Provide functions to build such extension in the extensions directory (see extensions/default.nix).

Optionally, create and link issues explaining chosen functions.

Each extension, including Extra extensions, is built via one of the functions in mkExtension.nix.

These functions don't modify the license of (unfree) extensions from nixpkgs.

Build problems

  • Extension with multiple extensions in a zipfile (issue)
  • Platform-specific extensions (comment)

Haskell script

See the ./haskell/README.md.

Troubleshooting

  • If Nix-provided VSCodium doesn't pick up the extensions:
    • Close other instances of Nix-provided VSCodium and start VSCodium again.
    • Try to reboot your computer and start VSCodium again.

About

Nix expressions for VS Code Marketplace and Open VSX extensions

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 21