blob: af720337ff05e71385482270e0c77777f76f3f55 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
{ pkgs, lib }:
let
libExt = pkgs.stdenv.hostPlatform.extensions.sharedLibrary;
grammarToAttrSet = drv:
{
name = "lib/lib${lib.strings.removeSuffix "-grammar" (lib.strings.getName drv)}${libExt}";
path = "${drv}/parser";
};
# Usage:
# treesit-grammars.with-grammars (p: [ p.tree-sitter-bash p.tree-sitter-c ... ])
with-grammars = fn: pkgs.linkFarm "emacs-treesit-grammars"
(map grammarToAttrSet (fn pkgs.tree-sitter.builtGrammars));
in
{
inherit with-grammars;
with-all-grammars = with-grammars builtins.attrValues;
}
|