foxfriends / syncat

Syntax aware cat
MIT License
53 stars 2 forks source link

Plugin manager v2 #15

Open foxfriends opened 1 year ago

foxfriends commented 1 year ago

Plugin manager works but needs work

adamdicarlo0 commented 7 months ago

Hi! Trying out syncat for the first time, and getting it to build and run on nix / NixOS. (That was actually quite easy!) I've only used it a little so far but it seems awesome!

More suggestions for the package management:

For Nix users

Allow using a build-time env var to dictate where tree-sitter parsers should be loaded from, so Nix users can install the treesitter parsers with Nix. The Nix module/flake for syncat could build a default set of parsers, and let you override the list by passing in the parsers' nix packages. 🤔

⚠️ I'm not certain a build-time env var is the best approach; I'm not a Nix expert and haven't written any Rust.

For non-Nix users

Thanks for making this project!

foxfriends commented 7 months ago

Allow using a build-time env var to dictate where tree-sitter parsers should be loaded from

This sounds like a great idea, unrelated to Nix at all. Even a runtime env var would likely work just fine? As the parsers are dynamically linked/loaded anyway, they can be located at runtime from anywhere. Though I know nothing about how Nix works, maybe that's not going to work for you guys, you'd have to tell me on that one!

Considering some possible approaches:

Thanks for the suggestions :)

foxfriends commented 7 months ago

Have implemented some of your suggestions in 3.7.0:

adamdicarlo0 commented 7 months ago

Oh, that's awesome, thank you!! 🚀 I wasn't considering the update (git pull) case for the packages, so a full clone does make sense. For Nix use, Nix would manage installing (and thus "upgrading") the tree-sitter parsers. It looks like Syncat's install command builds an object file in each parser directory (for interop with Syncat, I presume), so that will need to be part of the Nix build. I think I'll be able to build a decent Nix flake for Syncat... 🤔

foxfriends commented 7 months ago

Yes I think if the tree sitter binaries are compiled the way syncat needs them, it will work... if nix is already generating that file (just with a different name/location) it does seem reasonable to allow overriding the name of the file in the languages.toml file as well so that it can be located from anywhere, if that helps at all.