From 546086823393c4692a36ff263d151f263b8c633d Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Sun, 26 Jan 2025 03:00:02 +0300 Subject: [PATCH 1/4] feat(readme): add info about vscode-with-extensions --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d5a2ae89..b0ce6ca3 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,8 @@ In case of problems see [Troubleshooting](#troubleshooting). ## Example -[flake.nix](./flake.nix) provides a default package. +[flake.nix](./flake.nix) provides a default package using [vscode-with-extensions](https://github.com/NixOS/nixpkgs/blob/81b9a5f9d1f7f87619df26a4eaf48bf6dec8c82c/pkgs/applications/editors/vscode/with-extensions.nix) from `nixpkgs`. + This package is `VSCodium` with a couple of extensions. Run `VSCodium` and list installed extensions. From f02d2eadc3d49f0bb564a83ea5bfc534292bc495 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Sun, 26 Jan 2025 03:32:16 +0300 Subject: [PATCH 2/4] fix(readme): - update the link to the nixos wiki - make links to the nixos wiki more prominent --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b0ce6ca3..9ef37f84 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,10 @@ That said, you can now use a different set of extensions for `VS Code`/`VSCodium ## Note +> [!NOTE] +> Check the NixOS wiki [page](https://nixos.wiki/wiki/Visual_Studio_Code) about VS Code. + - Check [nix4vscode](https://github.com/nix-community/nix4vscode) (and contribute!) if you need a more individual approach to extensions. -- NixOS wiki has a [page](https://wiki.nixos.org/wiki/Visual_Studio_Code) 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](./data/cache/open-vsx-latest.json). - Access an extension in the format `..`, where `` is `vscode-marketplace`, `open-vsx`, etc. (see [Explore](#explore)). @@ -62,6 +64,9 @@ nix run github:nix-community/nix-vscode-extensions# -- --list-extensions ## Usage +> [!NOTE] +> Check the NixOS wiki [page](https://nixos.wiki/wiki/Visual_Studio_Code) about VS Code. + ### Extensions We provide extensions attrsets that contain both universal and platform-specific extensions. From b7bed27b6245d3675554d37ea8f9363f57ad6110 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Sun, 26 Jan 2025 13:13:36 +0300 Subject: [PATCH 3/4] feat(readme): explain some basic things --- README.md | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9ef37f84..b752ccbd 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ That said, you can now use a different set of extensions for `VS Code`/`VSCodium ## Template This repository has a flake [template](template/flake.nix). + This template provides a [VSCodium](https://github.com/VSCodium/vscodium) with a couple of extensions. 1. Create a flake from the template (see [nix flake new](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-new.html)). @@ -96,6 +97,11 @@ inputs.nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"; ### Without flakes +> [!NOTE] +> The values of `url`, `ref`, `rev` and in the `fetchGit` argument are for demonstration purposes. +> The value `c43d9089df96cf8aca157762ed0e2ddca9fcd71e` is the full SHA-256 hash of a commit in this repository. +> Replace it with the hash of the commit you need. + ```nix let system = builtins.currentSystem; @@ -113,19 +119,30 @@ in ... ## History -You can search for an extension in the repo 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: `0910d1e` -- search in that commit: `git grep '"copilot"' 0910d1e -- data/cache/vscode-marketplace-latest.json` +- 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` ## Explore Explore extensions via `nix repl`. -Use your system instead of `x86_64-linux`. +> [!NOTE] +> Press the `Tab` button (denoted as `` below) to see attrset attributes. + +### Get your system + +```console +nix-instantiate --eval --expr 'builtins.currentSystem' +``` + +Output on my machine: -Press the `Tab` button (denoted as `` here) to see attrset attributes. +```console +"x86_64-linux" +``` ### Get the `extensions` attrset @@ -149,6 +166,11 @@ t.open-vsx t.vscode-marketplace #### Get `extensions` without flakes +> [!NOTE] +> The values of `url`, `ref`, `rev` and in the `fetchGit` argument are for demonstration purposes. +> The value `c43d9089df96cf8aca157762ed0e2ddca9fcd71e` is the full SHA-256 hash of a commit in this repository. +> Replace it with the hash of the commit you need. + ```console $ nix repl @@ -193,12 +215,17 @@ nix-repl> (t.forVSCodeVersion "1.78.2").vscode-marketplace.rust-lang.rust-analyz Some extensions are hard to handle correctly ([example](https://github.com/nix-community/nix-vscode-extensions/issues/69)), so they have been removed via [removed.nix](./removed.nix). +They may be available in `nixpkgs`, in `pkgs.vscode-extensions` ([link](https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=vscode-extensions)). + ### Overlay See [Overlays](https://wiki.nixos.org/wiki/Overlays#Using_overlays). #### Get an overlay with flakes +> The value `c43d9089df96cf8aca157762ed0e2ddca9fcd71e` is the full SHA-256 hash of a commit in this repository. +> Replace it with the hash of the commit you need. + ```console nix-repl> :lf github:nix-community/nix-vscode-extensions/c43d9089df96cf8aca157762ed0e2ddca9fcd71e Added 14 variables. @@ -211,6 +238,9 @@ nix-repl> pkgs.vscode-marketplace-release.rust-lang.rust-analyzer #### Get an overlay without flakes +> The value `c43d9089df96cf8aca157762ed0e2ddca9fcd71e` is the full SHA-256 hash of a commit in this repository. +> Replace it with the hash of the commit you need. + ```console nix-repl> t1 = (import (builtins.fetchGit { url = "https://github.com/nix-community/nix-vscode-extensions"; From 112c73dbf4a448fbf6bc175956f1620ec6dfc853 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Sun, 26 Jan 2025 13:16:54 +0300 Subject: [PATCH 4/4] fix(readme): use a more recent commit in examples --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b752ccbd..a0781cfe 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ inputs.nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"; > [!NOTE] > The values of `url`, `ref`, `rev` and in the `fetchGit` argument are for demonstration purposes. -> The value `c43d9089df96cf8aca157762ed0e2ddca9fcd71e` is the full SHA-256 hash of a commit in this repository. +> The value `cb0aee6840fb29b70439880656ca6a313a6af101` is the full SHA-256 hash of a commit in this repository. > Replace it with the hash of the commit you need. ```nix @@ -109,7 +109,7 @@ let (import (builtins.fetchGit { url = "https://github.com/nix-community/nix-vscode-extensions"; ref = "refs/heads/master"; - rev = "c43d9089df96cf8aca157762ed0e2ddca9fcd71e"; + rev = "cb0aee6840fb29b70439880656ca6a313a6af101"; })).extensions.${system}; extensionsList = with extensions.vscode-marketplace; [ rust-lang.rust-analyzer @@ -151,7 +151,7 @@ Output on my machine: ```console $ nix repl -nix-repl> :lf github:nix-community/nix-vscode-extensions/c43d9089df96cf8aca157762ed0e2ddca9fcd71e +nix-repl> :lf github:nix-community/nix-vscode-extensions/cb0aee6840fb29b70439880656ca6a313a6af101 Added 10 variables. nix-repl> t = extensions. @@ -168,7 +168,7 @@ t.open-vsx t.vscode-marketplace > [!NOTE] > The values of `url`, `ref`, `rev` and in the `fetchGit` argument are for demonstration purposes. -> The value `c43d9089df96cf8aca157762ed0e2ddca9fcd71e` is the full SHA-256 hash of a commit in this repository. +> The value `cb0aee6840fb29b70439880656ca6a313a6af101` is the full SHA-256 hash of a commit in this repository. > Replace it with the hash of the commit you need. ```console @@ -177,7 +177,7 @@ $ nix repl nix-repl> t1 = (import (builtins.fetchGit { url = "https://github.com/nix-community/nix-vscode-extensions"; ref = "refs/heads/master"; - rev = "c43d9089df96cf8aca157762ed0e2ddca9fcd71e"; + rev = "cb0aee6840fb29b70439880656ca6a313a6af101"; })) nix-repl> t = t1.extensions. @@ -223,11 +223,12 @@ See [Overlays](https://wiki.nixos.org/wiki/Overlays#Using_overlays). #### Get an overlay with flakes -> The value `c43d9089df96cf8aca157762ed0e2ddca9fcd71e` is the full SHA-256 hash of a commit in this repository. +> [!NOTE] +> The value `cb0aee6840fb29b70439880656ca6a313a6af101` is the full SHA-256 hash of a commit in this repository. > Replace it with the hash of the commit you need. ```console -nix-repl> :lf github:nix-community/nix-vscode-extensions/c43d9089df96cf8aca157762ed0e2ddca9fcd71e +nix-repl> :lf github:nix-community/nix-vscode-extensions/cb0aee6840fb29b70439880656ca6a313a6af101 Added 14 variables. nix-repl> pkgs = (legacyPackages.x86_64-linux.extend overlays.default) @@ -238,14 +239,15 @@ nix-repl> pkgs.vscode-marketplace-release.rust-lang.rust-analyzer #### Get an overlay without flakes -> The value `c43d9089df96cf8aca157762ed0e2ddca9fcd71e` is the full SHA-256 hash of a commit in this repository. +> [!NOTE] +> The value `cb0aee6840fb29b70439880656ca6a313a6af101` is the full SHA-256 hash of a commit in this repository. > Replace it with the hash of the commit you need. ```console nix-repl> t1 = (import (builtins.fetchGit { url = "https://github.com/nix-community/nix-vscode-extensions"; ref = "refs/heads/master"; - rev = "c43d9089df96cf8aca157762ed0e2ddca9fcd71e"; + rev = "cb0aee6840fb29b70439880656ca6a313a6af101"; })) nix-repl> pkgs = import { overlays = [ t1.overlays.default ]; system = builtins.currentSystem; }