diff options
author | Ben Siraphob <bensiraphob@gmail.com> | 2022-03-21 23:51:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-21 23:51:52 -0500 |
commit | e6c5413578f4a775b57233bcd52beb32fb21630f (patch) | |
tree | a1697fe045c3edc9591c33e5ecc297ac5fe5a9df /pkgs/development/tools | |
parent | 1cec41b727197f8df4f203cb3dfffed80706ca45 (diff) | |
parent | 5b55eb42f1b14fdab2a09669fa27d44f492eb7e4 (diff) | |
download | nixlib-e6c5413578f4a775b57233bcd52beb32fb21630f.tar nixlib-e6c5413578f4a775b57233bcd52beb32fb21630f.tar.gz nixlib-e6c5413578f4a775b57233bcd52beb32fb21630f.tar.bz2 nixlib-e6c5413578f4a775b57233bcd52beb32fb21630f.tar.lz nixlib-e6c5413578f4a775b57233bcd52beb32fb21630f.tar.xz nixlib-e6c5413578f4a775b57233bcd52beb32fb21630f.tar.zst nixlib-e6c5413578f4a775b57233bcd52beb32fb21630f.zip |
Merge pull request #161456 from siraben/tree-sitter-overridable
Diffstat (limited to 'pkgs/development/tools')
-rw-r--r-- | pkgs/development/tools/parsing/tree-sitter/default.nix | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pkgs/development/tools/parsing/tree-sitter/default.nix b/pkgs/development/tools/parsing/tree-sitter/default.nix index c077913b1eb1..e3d74600c955 100644 --- a/pkgs/development/tools/parsing/tree-sitter/default.nix +++ b/pkgs/development/tools/parsing/tree-sitter/default.nix @@ -20,6 +20,7 @@ , enableShared ? !stdenv.hostPlatform.isStatic , enableStatic ? stdenv.hostPlatform.isStatic , webUISupport ? false +, extraGrammars ? {} }: # TODO: move to carnix or https://github.com/kolloch/crate2nix @@ -51,19 +52,18 @@ let runCommand "grammars" { } ('' mkdir $out '' + (lib.concatStrings (lib.mapAttrsToList - (name: grammar: "ln -s ${fetchGrammar grammar} $out/${name}\n") + (name: grammar: "ln -s ${if grammar ? src then grammar.src else fetchGrammar grammar} $out/${name}\n") (import ./grammars { inherit lib; })))); - builtGrammars = let change = name: grammar: callPackage ./grammar.nix { } { language = if grammar ? language then grammar.language else name; inherit version; - source = fetchGrammar grammar; + source = if grammar ? src then grammar.src else fetchGrammar grammar; location = if grammar ? location then grammar.location else null; }; - grammars' = (import ./grammars { inherit lib; }); + grammars' = import ./grammars { inherit lib; } // extraGrammars; grammars = grammars' // { tree-sitter-ocaml = grammars'.tree-sitter-ocaml // { location = "ocaml"; }; } // { tree-sitter-ocaml-interface = grammars'.tree-sitter-ocaml // { location = "interface"; }; } // @@ -71,7 +71,7 @@ let { tree-sitter-typescript = grammars'.tree-sitter-typescript // { location = "typescript"; }; } // { tree-sitter-tsx = grammars'.tree-sitter-typescript // { location = "tsx"; }; }; in - lib.mapAttrs change grammars; + lib.mapAttrs change (grammars); # Usage: # pkgs.tree-sitter.withPlugins (p: [ p.tree-sitter-c p.tree-sitter-java ... ]) |