karlprieb / nix-vscode-extensions

VSCode and OpenVSX extensions as Nix expressions

Home Page:https://github.com/nix-community/nix-vscode-marketplace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nix VSCode Extensions

At the time of writing this, searching nixpkgs yields around 200 VS Code extensions. However, the VS Code Marketplace contains more than 40,000 extensions!

This flake provides the Nix expressions for the majority of available extensions from Open VSX and VSCode Marketplace. A GitHub Action updates the extensions daily.

That said, you can now use a different set of extensions for VS Code (or 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!

Note

  • Extension names and publishers are lowercased.
  • If an extension's publisher or name aren't valid Nix identifiers, you may access them by quoting the attribute names like vscode-marketplace."4"."2".
  • You may search the repo to find out at what commit a given extension was available.
  • 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!

Template

A template shows how you can get a VSCodium with a couple of extensions. Try it:

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

This will print the extensions available in VSCodium.

Run codium . or nix run .#codium . to start VSCodium in the current directory.

In case of problems see Troubleshooting.

Example

There's a sample package vscodium-with-extensions with a couple of extensions that you can try.

nix run github:nix-community/nix-vscode-extensions#vscodium-with-extensions -- --list-extensions

Usage

With flakes

Add the following to your flake.nix (see Flakes).

inputs = {
  nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
};

Now, you can explore the extensions in nix repl:

$ nix repl
nix-repl> :lf .
Added 10 variables.

nix-repl> inputs.nix-vscode-extensions.extensions.x86_64-linux.vscode-marketplace.golang.go
«derivation /nix/store/ldx15dnxwd1sa3gb2lvs1rl4v0f5cq11-vscode-extension-golang-Go-0.37.1.drv»

nix-repl> inputs.nix-vscode-extensions.extensions.x86_64-linux.open-vsx.golang.go
«derivation /nix/store/sq3bm44dl8k1g1mm2daqix3ayjn289j2-vscode-extension-golang-Go-0.37.1.drv»

Alternatively, use an overlay (see overlays.default in flake.nix).

Without flakes

This repo provides a default.nix, so you can use, e.g.

(import (builtins.fetchGit {
  url = "https://github.com/nix-community/nix-vscode-extensions";
  ref = "refs/heads/master";
  rev = "a1980daf16eb0d8acfb6e17953d3945bfdac9a4d";
})).extensions.x86_64-linux.vscode-marketplace.golang.go

Alternatively, you may use an overlay (see overlays.default in flake.nix).

Contribute

Main flake

  1. See the issues

  2. (Optionally) Install direnv, e.g., via nix profile install nixpkgs#direnv.

  3. Run a devshell. When prompted about extra-trusted-substituters answer y. This is to use binary caches.

    nix develop nix-dev/
  4. (Optionally) Start VSCodium with necessary extensions and tools

    nix run nix-dev/#writeSettingsJson
    nix run nix-dev/#codium .

Haskell script

  1. See the hs/README.md

  2. Run a devshell. When prompted about extra-trusted-substituters answer y. This is to use binary caches.

    cd hs && nix develop

Troubleshooting

  • If VSCodium doesn't pick up the extensions, try to reboot your computer and start VSCodium again.
  • See troubleshooting.

About

VSCode and OpenVSX extensions as Nix expressions

https://github.com/nix-community/nix-vscode-marketplace

License:MIT License


Languages

Language:Haskell 66.8%Language:Nix 33.2%