-
Notifications
You must be signed in to change notification settings - Fork 46
Remove dependencies on Tree-sitter grammars #1032
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
base: main
Are you sure you want to change the base?
Conversation
b8f2e62
to
6f886f0
Compare
These changes work outside of Nix, but the CI complains inside (e.g., see here). My best guess is: Now that Does that sound plausible, @Niols? Adding the JSON and Nickel query files to the |
Sorry for the late reply.
That sounds plausible indeed. Especially, if the path to the query files involves
We could disable tests in the Nix package, but that's a bit sad. We could also make |
We currently rely on the tests to run in the CI, so disabling them is a bit of a non-starter. @yannham and @jneem: Have you any experience in this, from Nickel or elsewhere? |
Nix already has this sort of distinction between build dependencies and runtime dependencies. Downstream users would presumably just download the pre-built binaries from a Nix cache, which will also require runtime dependencies, but not build dependencies. |
@Xophmeister what does the Nix derivation precisely need from the removed dependencies? Just the text file, that is the query file and the sample sources? If yes, the simplest is to make a small trivial derivation making those available (no cargo, no Rust source, etc.), and depends on that. There's a second problem though, in that the paths to those files seem to be hardcoded in the test, but they will be different in the normal setup and in the Nix setup. A simple albeit ad-hoc solution could be to look into a specific environment variable, like |
Thanks, @yannham 🙏 Right, AFAIK, the only thing it's looking for are the JSON and Nickel query files. |
For instance, we have dedicated derivation for the manual markdown files or generating the stdlib documentation in Nickel, which are custom but lightweight. I guess something similar (simply copying some files to $out so that they are in the store) would work: https://github.com/tweag/nickel/blob/cd8513e73a7ef2651b29a7e8786269d9862e63a2/flake.nix#L607-L637 Here is an example of nickel-lang.org devshell consuming the manual derivation: https://github.com/tweag/nickel-lang.org/blob/a00806fe12419e2626f0e701fde83ec788ef97b5/flake.nix#L42 |
Very nice, @yannham! I do think this is the way to go; I'm not sure we need to re-inject it in the devShell the way you do it (but I might be missing for what use this is intended). The Nix part of this is not very complicated (maybe @AlexTereshenkov wants to have a go?), but it does require a way to tell the tests where to find the files that it wants. |
@Xophmeister does this need another review? |
@mkatychev No, not yet: It needs some more thought. The code changes I've made are all fine and work correctly, but it breaks the Nix build and I haven't had much opportunity to address that. |
Remove dependencies on Tree-sitter grammars
Resolves #1022
Resolves #1023
Description
Remove the development dependencies on
tree-sitter-json
andtree-sitter-nickel
. Instead, use the dynamic loading fromtopiary-config
in the relevant tests.Checklist
Checklist before merging, wherever relevant:
CHANGELOG.md
updatedREADME.md
, etc.) up-to-dateUpdated regression tests