tree-sitter: partially apply removePrefix calls

This commit is contained in:
Eman Resu
2026-07-20 10:30:11 -04:00
parent a4c143739a
commit cbd756b6a8
+5 -5
View File
@@ -80,6 +80,10 @@ let
name: value: hasTreeSitterPrefix name && lib.isDerivation value
);
removeTreesitterPrefix = lib.strings.removePrefix "tree-sitter-";
removeGrammarSuffix = lib.strings.removeSuffix "-grammar";
replaceHyphens = lib.strings.replaceStrings [ "-" ] "_";
mkGrammarLinkFarm =
grammars:
linkFarm "grammars" (
@@ -89,11 +93,7 @@ let
name = lib.strings.getName drv;
in
{
name =
(lib.strings.replaceStrings [ "-" ] [ "_" ] (
lib.strings.removePrefix "tree-sitter-" (lib.strings.removeSuffix "-grammar" name)
))
+ ".so";
name = (replaceHyphens (removeTreesitterPrefix (removeGrammarSuffix name))) + ".so";
path = "${drv}/parser";
}
) grammars