Skip to content

Commit

Permalink
feat(config): support better config
Browse files Browse the repository at this point in the history
Signed-off-by: loongtao.zhang <loongtao.zhang@outlook.com>
  • Loading branch information
cathaysia committed Jan 12, 2025
1 parent 9eb15a8 commit 55d1be2
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 475 deletions.
78 changes: 5 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ A tool generate nix expression from `config.toml`. Assuming we have a `config.to
```toml
vscode_version = "1.81.1"

[[extensions]]
publisher_name = "eamodio"
extension_name = "gitlens"

[[extensions]]
publisher_name = "vscodevim"
extension_name = "vim"
extensions = [
"eamodio.gitlens",
"vscodevim.vim",
{ publisher_name = "ms-python", extension_name = "debugpy" },
]
```

We can then run `cargo run -- config.toml`, and a nix expression will be print to `stdout` just like this:
Expand Down Expand Up @@ -92,69 +90,3 @@ done
```

Just create the script, make it executable and then pipe the output to your `config.toml` file.

## Redirect asset_url

For some extensions (such as codelldb), there is only a downloader in vscode markplace, and the real location of the extension is on github. At this time, asset_url is allowed to be redirected:

```toml
vscode_version = "1.81.1"

[[extensions]]
publisher_name = "vadimcn"
extension_name = "vscode-lldb"
asset_url = '''
https://github.com/vadimcn/codelldb/releases/download/v{{ extension.version }}/codelldb-{{ system.arch }}-{{ system.ostype }}.vsix
'''
```

asset_url is a jinja template string.

<!--
```nix
friendly-snippets = pkgs.vscode-utils.buildVscodeExtension {
name = "friendly-snippets";
vscodeExtPublisher = "rafamadriz";
vscodeExtName = "friendly-snippets";
src = (pkgs.fetchurl {
url = "https://github.com/cathaysia/friendly-snippets/archive/refs/heads/version.zip";
sha256 = "sha256-4TlMkVqaEgTO2kJrldJQl0MlZmF332ESarwoQpMylso=";
name = "friendly-snippets.zip";
}).outPath;
vscodeExtUniqueId = "rafamadriz.friendly-snippets";
version = "1.0.0";
}
```
```nix
vscode-utils.extensionsFromVscodeMarketplace [
{
name = "gitblame";
publisher = "waderyan";
version = "10.4.0";
sha256 = "sha256-PPPlMGti+nRex6PBOxyu2qh6Rphl8kfdL9neNK1KkD0=";
}
{
name = "python";
publisher = "ms-python";
version = "2023.15.12151010";
sha256 = "sha256-gkQBAJudSUY19cCo0cD1uq61ZhtM/MeDz21k1LvNv64=";
}
]
```
```nix
vscode-lldb = pkgs.vscode-utils.buildVscodeExtension {
name = "vadimcn.vscode-lldb";
vscodeExtPublisher = "vadimcn";
vscodeExtName = "codelldb";
src = (pkgs.fetchurl {
url = "https://github.com/vadimcn/codelldb/releases/download/v1.9.2/codelldb-x86_64-linux.vsix";
sha256 = "sha256-iYvSKyUFsSZx/ufS/hq7OE3GDRP1/sK0tlDQ2sP4PXU=";
name = "codelldb.zip";
}).outPath;
vscodeExtUniqueId = "vadimcn.vscode-lldb";
version = "1.9.2";
};
```
-->
Loading

0 comments on commit 55d1be2

Please sign in to comment.