At the time of writing this, nixpkgs
contains 271 VS Code
extensions. This is a small fraction of the more than 40,000 extensions in the VS Code Marketplace
! In addition, many of the extensions in nixpkgs
are significantly out-of-date.
This flake provides Nix expressions for the majority of available extensions from Open VSX and VS Code Marketplace. A GitHub Action
updates the extensions daily.
That said, you can now use a different set of extensions for VS Code
/VSCodium
in each of your projects. Moreover, you can share your flakes and cache them so that other people don't need to install these extensions manually!
.json
cache files such as data/cache/open-vsx-latest.json.<attrset>.<publisher>.<name>
, where <attrset>
is vscode-marketplace
, open-vsx
, etc. (see Explore).<attrset>."4"."2"
.VS Code Marketplace
or an Open VSX
response about the full set of available extensions.maxMissingTimes
(specified in .github/config.yaml).This repository has a flake template. This template provides a VSCodium with a couple of extensions.
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 .
Run VSCodium
.
nix run .# .
Alternatively, start a devShell and run VSCodium
. A shellHook
will print extensions available in the VSCodium
.
nix develop
codium .
In case of problems see Troubleshooting.
flake.nix provides a default package.
This package is VSCodium
with a couple of extensions.
Run VSCodium
and list installed extensions.
nix run github:nix-community/nix-vscode-extensions# -- --list-extensions
We provide extensions attrsets that contain both universal and platform-specific extensions.
We use a reasonable mapping between the sites target platforms and Nix-supported platforms (see the issue and systemPlatform
in flake.nix).
There are several attrsets:
vscode-marketplace
and open-vsx
contain the latest versions of extensions, including pre-release ones. Such pre-release versions expire in some time. That's why, there are -release
attrsets.vscode-marketplace-release
and open-vsx-release
contain the release versions of extensions (see Release extensions).forVSCodeVersion "4.228.1"
allows to leave only the extensions compatible with the "4.228.1"
version of VS Code
.
VS Code
instead of "4.228.1"
.[!NOTE] In
with A; with B;
, the attributes ofB
shadow the attributes ofA
. Keep in mind this property ofwith
when writingwith vscode-marketplace; with vscode-marketplace-release;
. See With-expressions.
See Template.
Add the following to your flake.nix
(see Flakes).
inputs.nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
let
system = builtins.currentSystem;
extensions =
(import (builtins.fetchGit {
url = "https://github.com/nix-community/nix-vscode-extensions";
ref = "refs/heads/master";
rev = "c43d9089df96cf8aca157762ed0e2ddca9fcd71e";
})).extensions.${system};
extensionsList = with extensions.vscode-marketplace; [
rust-lang.rust-analyzer
];
in ...
You can search for an extension in the repo history:
git log -S '"copilot"' --oneline data/cache/vscode-marketplace-latest.json
0910d1e
git grep '"copilot"' 0910d1e -- data/cache/vscode-marketplace-latest.json
Explore extensions via nix repl
.
Use your system instead of x86_64-linux
.
Press the Tab
button (denoted as <TAB>
here) to see attrset attributes.
extensions
attrsetextensions
with flakes$ nix repl
nix-repl> :lf github:nix-community/nix-vscode-extensions/c43d9089df96cf8aca157762ed0e2ddca9fcd71e
Added 10 variables.
nix-repl> t = extensions.<TAB>
extensions.aarch64-darwin extensions.aarch64-linux extensions.x86_64-darwin extensions.x86_64-linux
nix-repl> t = extensions.x86_64-linux
nix-repl> t.<TAB>
t.forVSCodeVersion t.open-vsx-release t.vscode-marketplace-release
t.open-vsx t.vscode-marketplace
extensions
without flakes$ nix repl
nix-repl> t1 = (import (builtins.fetchGit {
url = "https://github.com/nix-community/nix-vscode-extensions";
ref = "refs/heads/master";
rev = "c43d9089df96cf8aca157762ed0e2ddca9fcd71e";
}))
nix-repl> t = t1.extensions.<TAB>
t1.extensions.aarch64-darwin t1.extensions.aarch64-linux t1.extensions.x86_64-darwin t1.extensions.x86_64-linux
nix-repl> t = t1.extensions.x86_64-linux
nix-repl> t.<TAB>
t.forVSCodeVersion t.open-vsx-release t.vscode-marketplace-release
t.open-vsx t.vscode-marketplace
nix-repl> t.vscode-marketplace.rust-lang.rust-analyzer
«derivation /nix/store/jyzab0pdcgj4q9l73zsnyvc1k7qpb381-vscode-extension-rust-lang-rust-analyzer-0.4.1582.drv»
nix-repl> t.vscode-marketplace-release.rust-lang.rust-analyzer
«derivation /nix/store/qjlr7iqgqrf2hd2z21xz96nmblxy680m-vscode-extension-rust-lang-rust-analyzer-0.3.1583.drv»
nix-repl> (t.forVSCodeVersion "1.78.2").vscode-marketplace.rust-lang.rust-analyzer
«derivation /nix/store/jyzab0pdcgj4q9l73zsnyvc1k7qpb381-vscode-extension-rust-lang-rust-analyzer-0.4.1582.drv»
See Overlays.
nix-repl> :lf github:nix-community/nix-vscode-extensions/c43d9089df96cf8aca157762ed0e2ddca9fcd71e
Added 14 variables.
nix-repl> pkgs = (legacyPackages.x86_64-linux.extend overlays.default)
nix-repl> pkgs.vscode-marketplace-release.rust-lang.rust-analyzer
«derivation /nix/store/midv6wrnpxfm3in3miilyx914zzck4d7-vscode-extension-rust-lang-rust-analyzer-0.3.1575.drv»
nix-repl> t1 = (import (builtins.fetchGit {
url = "https://github.com/nix-community/nix-vscode-extensions";
ref = "refs/heads/master";
rev = "c43d9089df96cf8aca157762ed0e2ddca9fcd71e";
}))
nix-repl> pkgs = import <nixpkgs> { overlays = [ t1.overlays.default ]; system = builtins.currentSystem; }
nix-repl> pkgs.vscode-marketplace-release.rust-lang.rust-analyzer
«derivation /nix/store/a701wlb8ckidpikr57bff16mmvsf3jir-vscode-extension-rust-lang-rust-analyzer-0.3.1575.drv»
Resolve issues.
The config contains several extensions. We cache the information about the latest release versions of these extensions (see Extensions).
You can add new extensions to the config and make a Pull Request.
Use the original extension publisher and name, e.g. GitHub
and copilot
.
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.
Certain extensions require special treatment.
Provide functions to modify such extension in overrides.nix.
Optionally, create and link there issues explaining chosen override functions.
Overrides apply to a whole attrset of extensions, including Extra extensions.
Each override is applied to an argument of the buildVscodeMarketplaceExtension
function.
(Optionally) Install direnv, e.g., via nix profile install nixpkgs#direnv
.
Run a devshell. When prompted about extra-trusted-substituters
answer y
. This is to use binary caches.
nix develop nix-dev/
(Optionally) Start VSCodium
with necessary extensions and tools.
nix run nix-dev/#writeSettings
nix run nix-dev/#codium .
See the README.
Set the environment.
set -a
source .env
Run the script.
nix run haskell/#updateExtensions
Pull requests are welcome!
Nix
-provided VSCodium
doesn't pick up the extensions:
Nix
-provided VSCodium
.VSCodium
again.