Change:
<ins> { lib , pkgs , symlinkJoin , fetchzip , melpaBuild , stdenv , fetchFromGitHub , writeText , melpaStablePackages , runCommand , tree-sitter-grammars , plugins ? map (g: tree-sitter-grammars.${g}) (lib.importJSON ./default-grammars.json) , final }: let inherit (melpaStablePackages) tree-sitter-langs; libSuffix = if stdenv.isDarwin then "dylib" else "so"; soName = g: lib.removeSuffix "-grammar" (lib.removePrefix "tree-sitter-" g.pname) + "." + libSuffix; grammarDir = runCommand "emacs-tree-sitter-grammars" { # Fake same version number as upstream language bundle to prevent triggering runtime downloads inherit (tree-sitter-langs) version; } ('' install -d $out/langs/bin echo -n $version > $out/langs/bin/BUNDLE-VERSION '' + lib.concatStringsSep "n" (map ( g: "ln -s ${g}/parser $out/langs/bin/${soName g}") plugins )); in melpaStablePackages.tree-sitter-langs.overrideAttrs(old: { postPatch = old.postPatch or "" + '' substituteInPlace ./tree-sitter-langs-build.el  --replace "tree-sitter-langs-grammar-dir tree-sitter-langs--dir"  "tree-sitter-langs-grammar-dir "${grammarDir}/langs"" ''; passthru = old.passthru or {} // { inherit plugins; withPlugins = fn: final.tree-sitter-langs.override { plugins = fn tree-sitter-grammars; }; }; }) </ins>

Discussion:
Describe the bug The Emacs packages for don't successfully load. To Reproduce Run a from the following : After opening Emacs from inside the and running , we get the following: Expected behavior The packages should be properly loaded, and they should offer syntax-highlighting for select languages. Notify maintainers No one has any particular responsibility for this package. But might be interested in this. Metadata Please run and paste the result.
I'm currently using this, but it stills need some work. Languages grammar are downloaded instead of being built (each language should have it's own separate nix package), and I'm not happy about the but if the grammar bins are in directory will put them in the .
I marked this as stale due to inactivity. &rarr;
Unstale
facing the same issue
Same. What's going on with this issue?
So, I've been looking into this a bit and kind of understand what should be done, but haven't been able to create enough code for a working PR yet. So, basically what you want is to build a rust package from here: The result of the build is and this needs to be built as a dependency for so the file is available for it as . I think it should be enough to link whatever file gets compiled from to the if I read the code correctly. Then, the next is to link all the compiled tree-sitter grammars for the emacs package to find, something copied from how the neovim plugin does this: I'm not completely sure where to build all these packages and I'm running out of my personal time to get this working together. What I see in the current state is many packages linking as a dependency, but is just building the emacs package, not using to build whatever is in the directory and linking the resulting library for the lisp libraries. And the grammars are already in the nixpkgs, you just need to link them to a place where the emacs tree-sitter plugin can find them.
Hey all. I'm still working on fixing this due to me needing tree-sitter for my emacs setup and wanting to understand nix more. Here's the work so far: It now compiles the rust module correctly, and uses the linking strategy from for the languages.

It still tries to download files from github, so I either don't link the files to the correct location, or I should patch a method to prevent the download process. I think the best solution would be to use the grammars already available in the monorepo the same way as does. My first try with them was with , but some of them won't work together with the emacs library due to licensing issues. And I also got myself to the download problem, but I think this is not due to files not being the pre-compiled ones from github, but again about some linking issues. If somebody wants to try this out and give me feedback, I'm all ears. I will probably spend some Christmas holiday spare time to make the PR happen. It is very close already.
I made a PR and now it works at least on my NixOS laptop. It would still be nice if we could either utilize the grammars already available in nix, or at least we'd be able to compile them in the derivation instead of just downloading the binaries. I'd be happy if you could try this out and see if it works for you.