{ runCommand , fetchFromGitea , ... } @ inputs: let inherit (builtins) readFile; extraGrammars = { tree-sitter-d2 = { language = "d2"; version = "2023-06-17"; src = fetchFromGitea { domain = "git.pleshevski.ru"; owner = "pleshevskiy"; repo = "tree-sitter-d2"; rev = "9828b023cddec65028805e76266a07a91345d77b"; sha256 = "sha256-8bDFNvftuegTkvzbB7Pi7Wz/o30lYqftGcQqWOfSTmw="; }; }; }; tree-sitter = (inputs.tree-sitter.override { inherit extraGrammars; }); customGrammars = tree-sitter.withPlugins (g: [ g.tree-sitter-d2 ]); nvim-treesitter = (inputs.nvim-treesitter.withPlugins (g: [ # g.agda # g.arduino # g.astro g.awk g.bash # g.beancount # g.bibtex # g.blueprint # g.c # g.c_sharp # g.clojure g.cmake g.comment g.commonlisp # g.cooklang # g.cpp g.css # g.cuda # g.d # g.d2 # g.dart # g.devicetree g.diff g.dockerfile # g.dot # g.eex # g.elixir g.elm # g.elvish g.embedded_template # g.erlang # g.fennel # g.fish # g.foam # g.fortran # g.fusion # g.gdscript g.git_rebase g.gitattributes g.gitignore # g.gleam # g.glimmer # g.glsl # g.go # g.godot_resource # g.gomod # g.gowork g.graphql # g.hack g.haskell # g.hcl # g.heex # g.hjson # g.hlsl # g.hocon g.html g.http # g.java g.javascript g.jq g.jsdoc g.json g.json5 g.jsonc # g.jsonnet # g.julia # g.kotlin # g.lalrpop # g.latex g.ledger # g.llvm g.lua # g.m68k g.make g.markdown g.markdown_inline # g.menhir # g.meson # g.nickel # g.ninja g.nix # g.norg # g.ocaml # g.ocaml_interface # g.ocamllex g.org # g.pascal # g.perl # g.php # g.phpdoc # g.pioasm # g.prisma # g.proto g.pug g.python # g.ql # g.qmljs g.query # g.r # g.racket # g.rasi g.regex # g.rego # g.rnoweb # g.rst # g.ruby g.rust # g.scala g.scheme g.scss # g.slint # g.solidity # g.sparql g.sql # g.supercollider # g.surface # g.svelte # g.swift # g.sxhkdrc # g.teal # g.tiger # g.tlaplus g.todotxt # g.toml # g.tsx # g.turtle # g.twig g.typescript # g.v # g.vala # g.verilog # g.vhs g.vim g.vue # g.wgsl g.yaml # g.yang # g.zig ])).overrideAttrs (oldAttrs: { passthru.dependencies = oldAttrs.passthru.dependencies ++ [ (runCommand "nvim-treesitter-d2-grammar" { } '' mkdir -p $out/parser ln -s ${customGrammars}/d2.so $out/parser/d2.so '') ]; postPatch = '' ln -s ${extraGrammars.tree-sitter-d2.src}/queries queries/d2 ''; }); in { luaConfig = readFile ./treesitter.lua; plugins = [ nvim-treesitter ]; }