Turns out that 'tree-sitter' is not wrapped to have node and a compiler available, because nixpkgs assumes that grammars already include generated files. So wrap it manually and use that in our pre-commit/checks.
This commit is contained in:
parent
02f89ac524
commit
752f941589
24
flake.nix
24
flake.nix
|
@ -53,6 +53,26 @@
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = [ self.overlays.default ];
|
overlays = [ self.overlays.default ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tree-sitter-env = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "tree-sitter-env";
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
|
||||||
|
dontBuild = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
makeWrapper \
|
||||||
|
${pkgs.tree-sitter}/bin/tree-sitter \
|
||||||
|
$out/bin/tree-sitter \
|
||||||
|
--prefix PATH : "${with pkgs; lib.makeBinPath [stdenv.cc nodejs]}"
|
||||||
|
'';
|
||||||
|
};
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
checks = {
|
checks = {
|
||||||
|
@ -77,14 +97,14 @@
|
||||||
tree-sitter = {
|
tree-sitter = {
|
||||||
enable = true;
|
enable = true;
|
||||||
name = "tree-sitter tests";
|
name = "tree-sitter tests";
|
||||||
entry = "${pkgs.tree-sitter}/bin/tree-sitter test";
|
entry = "${tree-sitter-env}/bin/tree-sitter test";
|
||||||
pass_filenames = false;
|
pass_filenames = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
tree-sitter-files = {
|
tree-sitter-files = {
|
||||||
enable = true;
|
enable = true;
|
||||||
name = "tree-sitter generated files";
|
name = "tree-sitter generated files";
|
||||||
entry = "${pkgs.tree-sitter}/bin/tree-sitter generate";
|
entry = "${tree-sitter-env}/bin/tree-sitter generate";
|
||||||
pass_filenames = false;
|
pass_filenames = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue