nixpkgs/pkgs/development/tools/parsing/tree-sitter/library.nix
Matthieu Coudron 53ae5f76a2 tree-sitter.builtGrammars: build parser libraries
except for typescript that provokes an error.
These libraries can be used on neovim 0.5 for instance.
2020-03-06 08:01:35 +01:00

31 lines
477 B
Nix

{ stdenv
, language
, tree-sitter
, version
, source
}:
stdenv.mkDerivation {
pname = "tree-sitter-${language}-library";
inherit version;
src = source;
buildInputs = [ tree-sitter ];
dontUnpack = true;
configurePhase= ":";
buildPhase = ''
runHook preBuild
$CC -I$src/src/ -shared -o parser -Os $src/src/parser.c
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir $out
mv parser $out/
runHook postInstall
'';
}