Code change:
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.

Related discussion:
text: <ins> { lib , symlinkJoin , melpaBuild , fetchFromGitHub , rustPlatform , writeText , clang , llvmPackages , runtimeShell , writeScript , python3 , nix-prefetch-github , nix }: let srcMeta = lib.importJSON ./src.json; inherit (srcMeta) version; src = fetchFromGitHub srcMeta.src; tsc = melpaBuild { inherit src; inherit version; pname = "tsc"; commit = version; sourceRoot = "source/core"; recipe = writeText "recipe" '' (tsc :repo "emacs-tree-sitter/elisp-tree-sitter" :fetcher github) ''; }; tsc-dyn = rustPlatform.buildRustPackage { inherit version; inherit src; pname = "tsc-dyn"; nativeBuildInputs = [ clang ]; sourceRoot = "source/core"; configurePhase = '' export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib" ''; postInstall = '' LIB=($out/lib/libtsc_dyn.*) TSC_PATH=$out/share/emacs/site-lisp/elpa/tsc-${version} install -d $TSC_PATH install -m444 $out/lib/libtsc_dyn.* $TSC_PATH/''${LIB/*libtsc_/tsc-} echo -n $version > $TSC_PATH/DYN-VERSION rm -r $out/lib ''; inherit (srcMeta) cargoSha256; }; in symlinkJoin { name = "tsc-${version}"; paths = [ tsc tsc-dyn ]; passthru = { updateScript = let pythonEnv = python3.withPackages(ps: [ ps.requests ]); in writeScript "tsc-update" '' #!${runtimeShell} set -euo pipefail export PATH=${lib.makeBinPath [ nix-prefetch-github nix pythonEnv ]}:$PATH exec python3 ${builtins.toString ./update.py} ${builtins.toString ./.} ''; }; meta = { description = "The core APIs of the Emacs binding for tree-sitter."; license = lib.licenses.mit; maintainers = with lib.maintainers; [ pimeys ]; }; } </ins>