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!
- Check nix4vscode (and contribute!) if you need a more individual approach to extensions.
- NixOS wiki has a page about VS Code.
- Extension publishers and names are lowercased only in Nix.
- They're not lowercased in
.json
cache files such as data/cache/open-vsx-latest.json.
- They're not lowercased in
- Access an extension in the format
<attrset>.<publisher>.<name>
, where<attrset>
isvscode-marketplace
,open-vsx
, etc. (see Explore). - If an extension publisher or name aren't valid Nix identifiers, quote them like
<attrset>."4"."2"
. - We have a permission from MS to use a crawler on their API in this case (see the discussion). Please, don't abuse this flake!
- 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 anOpen VSX
response about the full set of available extensions. - We let missing extensions remain in cache files (see data/cache) at most
maxMissingTimes
(specified in .github/config.yaml).
- An extension is missing if it doesn't appear during a particular workflow run in a
- We don't automatically handle extension packs. You should look up extensions in a pack and explicitly write all necessary extensions.
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
. AshellHook
will print extensions available in theVSCodium
.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
andopen-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
andopen-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 ofVS Code
.- You may supply the actual version of your
VS Code
instead of"4.228.1"
.
- You may supply the actual version of your
Note
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;
.
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:
- get commits containing the extension:
git log -S '"copilot"' --oneline data/cache/vscode-marketplace-latest.json
- select a commit:
0910d1e
- search in that commit:
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.
$ 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
$ 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.
- Fix links.
- Write new sections.
- Update commit SHA used in examples if they're too old.
- Enhance text.
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
answery
. 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!
- If
Nix
-providedVSCodium
doesn't pick up the extensions:- Close other instance of
Nix
-providedVSCodium
. - Try to reboot your computer and start
VSCodium
again.
- Close other instance of
- See troubleshooting.