Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config): support better config #197

Merged
merged 1 commit into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading