Skip to content
New issue

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

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

Already on GitHub? # to your account

How to add tree-sitter parser as luaPackages? #344

Open
boltlessengineer opened this issue Sep 6, 2024 · 1 comment
Open

How to add tree-sitter parser as luaPackages? #344

boltlessengineer opened this issue Sep 6, 2024 · 1 comment

Comments

@boltlessengineer
Copy link

I want to make neorocks test overlay to rest.nvim, and rest.nvim has a dependency to tree-sitter-http.
How can I specify luarocks dependency to tree-sitter-http?
using luaPackages didn’t work and I can’t understand why:

# nix/test-overlay.nix
{
  self,
  inputs,
}: final: prev: let
  mkNeorocksTest = name: nvim:
    with final;
      neorocksTest {
        inherit name;
        pname = "rest.nvim";
        src = self;
        neovim = nvim;
        luaPackages = ps:
          with ps; [
            luarocks
            nvim-nio
            mimetypes
            xml2lua
            fidget-nvim
            tree-sitter-http
          ];

        extraPackages = [
          curl
        ];

        preCheck = ''
          export HOME=$(realpath .)
        '';
      };
  # …
in {
  integration-stable = mkNeorocksTest "integration-stable" final.neovim;
  integration-nightly = mkNeorocksTest "integration-nightly" final.neovim-nightly;
  inherit docgen;
}
ubuntu@boltless-dev:~/repo/rest.nvim$ nix flake check
warning: Git tree '/home/ubuntu/repo/rest.nvim' is dirty
error:
       � while checking flake output 'checks'
         at /nix/store/na7sykizsgkzh9i3wc8m8pz5xfqib2rv-source/lib.nix:39:17:
           38|               {
           39|                 ${key} = (attrs.${key} or { })
             |                 ^
           40|                   // { ${system} = ret.${key}; };

       � while checking the derivation 'checks.aarch64-linux.integration-nightly'
         at /nix/store/k0p7z3ayfckfkm7jl4dmv4adqdydxhz5-source/flake.nix:63:13:
           62|             (pkgs)
           63|             integration-nightly
             |             ^
           64|             ;

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: undefined variable 'tree-sitter-http'
       at /nix/store/k0p7z3ayfckfkm7jl4dmv4adqdydxhz5-source/nix/test-overlay.nix:19:13:
           18|             fidget-nvim
           19|             tree-sitter-http
             |             ^
           20|           ];
@boltlessengineer boltlessengineer changed the title How to add tree-sitter parser? How to add tree-sitter parser as luaPackages? Sep 6, 2024
@mrcjkb
Copy link
Member

mrcjkb commented Sep 6, 2024

The problem here is that tree-sitter-http hasn't been packaged for nixpkgs.
@teto and I will probably be working on that eventually.
For now, you can use luarocks-nix to generate a nix expression for building the package with nix.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants