mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-10-15 17:07:25 +03:00
emacs.pkgs.tree-sitter-langs: Make language plugins configurable
By using an expression like: ``` nix emacs.pkgs.tree-sitter-langs.passthru.withPlugins (p: [ p.tree-sitter-agda ]) ```
This commit is contained in:
parent
b4f90318fe
commit
daee75e5b3
@ -233,7 +233,7 @@
|
||||
|
||||
sv-kalender = callPackage ./sv-kalender { };
|
||||
|
||||
tree-sitter-langs = callPackage ./tree-sitter-langs { };
|
||||
tree-sitter-langs = callPackage ./tree-sitter-langs { final = self; };
|
||||
tsc = callPackage ./tsc { };
|
||||
|
||||
youtube-dl = callPackage ./youtube-dl { };
|
||||
|
@ -9,13 +9,13 @@
|
||||
, melpaStablePackages
|
||||
, runCommand
|
||||
, tree-sitter-grammars
|
||||
, plugins ? map (g: tree-sitter-grammars.${g}) (lib.importJSON ./default-grammars.json)
|
||||
, final
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (melpaStablePackages) tree-sitter-langs;
|
||||
|
||||
grammars = map (g: tree-sitter-grammars.${g}) (lib.importJSON ./default-grammars.json);
|
||||
|
||||
libSuffix = if stdenv.isDarwin then "dylib" else "so";
|
||||
soName = g: lib.removeSuffix "-grammar" (lib.removePrefix "tree-sitter-" g.pname) + "." + libSuffix;
|
||||
|
||||
@ -26,7 +26,7 @@ let
|
||||
install -d $out/langs/bin
|
||||
echo -n $version > $out/langs/bin/BUNDLE-VERSION
|
||||
'' + lib.concatStringsSep "\n" (map (
|
||||
g: "ln -s ${g}/parser $out/langs/bin/${soName g}") grammars
|
||||
g: "ln -s ${g}/parser $out/langs/bin/${soName g}") plugins
|
||||
));
|
||||
|
||||
in
|
||||
@ -35,4 +35,10 @@ melpaStablePackages.tree-sitter-langs.overrideAttrs(old: {
|
||||
substituteInPlace ./tree-sitter-langs-build.el \
|
||||
--replace "tree-sitter-langs-grammar-dir tree-sitter-langs--dir" "tree-sitter-langs-grammar-dir \"${grammarDir}/langs\""
|
||||
'';
|
||||
|
||||
passthru = old.passthru or {} // {
|
||||
inherit plugins;
|
||||
withPlugins = fn: final.tree-sitter-langs.override { plugins = fn tree-sitter-grammars; };
|
||||
};
|
||||
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user