tree-sitter-nix-shell: make compatible with tree-sitter 0.15
This commit is contained in:
@@ -1,18 +1,21 @@
|
|||||||
{ lib
|
{
|
||||||
, fetchFromGitea
|
fetchFromGitea,
|
||||||
, htmlq
|
htmlq,
|
||||||
, tree-sitter
|
lib,
|
||||||
, tree-sitter-nix-shell
|
neovimUtils,
|
||||||
|
tree,
|
||||||
|
tree-sitter,
|
||||||
|
tree-sitter-nix-shell,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
tree-sitter.buildGrammar {
|
tree-sitter.buildGrammar {
|
||||||
version = "0.1.0";
|
version = "0.2.0";
|
||||||
src = fetchFromGitea {
|
src = fetchFromGitea {
|
||||||
domain = "git.uninsane.org";
|
domain = "git.uninsane.org";
|
||||||
owner = "colin";
|
owner = "colin";
|
||||||
repo = "tree-sitter-nix-shell";
|
repo = "tree-sitter-nix-shell";
|
||||||
rev = "c2fcc8b6ee91af2cb58a38f62c0800f82d783738";
|
rev = "41849dc40d776841a3104d15c8b8ac69425f17f7";
|
||||||
hash = "sha256-NU7p4KieSkYRhTSgL5qwFJ9n7hGJwTn0rynicfOf9oA=";
|
hash = "sha256-6+I3EiKj82yzyteV1jkhI2aHaBPw5E7cLUztnYhieWk=";
|
||||||
};
|
};
|
||||||
|
|
||||||
language = "nix-shell";
|
language = "nix-shell";
|
||||||
@@ -21,17 +24,39 @@ tree-sitter.buildGrammar {
|
|||||||
|
|
||||||
nativeCheckInputs = [ htmlq ];
|
nativeCheckInputs = [ htmlq ];
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
|
runHook preCheck
|
||||||
(cd ..; make test)
|
(cd ..; make test)
|
||||||
|
runHook postCheck
|
||||||
'';
|
'';
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
||||||
|
nativeInstallCheckInputs = [ tree ];
|
||||||
|
installCheckPhase = ''
|
||||||
|
runHook preInstallCheck
|
||||||
|
|
||||||
|
# i'm too dumb to know which installed files are necessary for e.g. neovim,
|
||||||
|
# but the original package (pre 2025-03-15) had:
|
||||||
|
# - $out/parser (elf file; also found in e.g. vimPlugins.nvim-treesitter.grammarPlugins.latex.origGrammar)
|
||||||
|
# - $out/queries/{highlights.scm,injections.scm}
|
||||||
|
#
|
||||||
|
# N.B. that said original parser never actually worked with neovim (only with helix?)
|
||||||
|
(test -x $out/parser && test -f $out/queries/highlights.scm && test -f $out/queries/injections.scm) || \
|
||||||
|
(tree $out; echo "expected output to contain /parser and /queries/"; false)
|
||||||
|
|
||||||
|
runHook postInstallCheck
|
||||||
|
'';
|
||||||
|
doInstallCheck = true;
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
generated = tree-sitter-nix-shell.overrideAttrs (orig: {
|
generated = tree-sitter-nix-shell.overrideAttrs (orig: {
|
||||||
# provide a package which has the output of `tree-sitter generate`, but not the binary compiled parser
|
# provide a package which has the output of `tree-sitter generate`, but not the binary compiled parser
|
||||||
buildPhase = "true";
|
dontBuild = true;
|
||||||
installPhase = "cp -r . $out";
|
installPhase = "cp -r . $out";
|
||||||
checkPhase = "true";
|
doCheck = false;
|
||||||
|
doInstallCheck = false;
|
||||||
});
|
});
|
||||||
|
# see comment in <repo:nixos/nixpkgs:pkgs/applications/editors/neovim/utils.nix>
|
||||||
|
nvimPlugin = neovimUtils.grammarToPlugin tree-sitter-nix-shell;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
Reference in New Issue
Block a user