This repository has been archived on 2024-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
neovim/plugins/syntax/default.nix

46 lines
1.0 KiB
Nix

{ lib
, runCommand
, fetchFromGitHub
, ...
} @ inputs:
let
inherit (builtins) readFile;
extraGrammars = {
tree-sitter-d2 = {
language = "d2";
src = fetchFromGitHub {
owner = "pleshevskiy";
repo = "tree-sitter-d2";
rev = "9e60a469c5b67899f3ace13f32a43abc0ba74ec4";
sha256 = "sha256-FC2AP1DqeetfrjhSdp2QWHbW0qylImc4PeQXPvg7uT8=";
};
version = "0.0.0";
};
};
tree-sitter = (inputs.tree-sitter.override { inherit extraGrammars; });
grammars = tree-sitter.withPlugins (g: [ g.tree-sitter-d2 ]);
nvim-treesitter = inputs.nvim-treesitter.withAllGrammars.overrideAttrs (oldAttrs: {
passthru.dependencies = oldAttrs.passthru.dependencies ++ [
(runCommand "nvim-treesitter-d2-grammar" { } ''
mkdir -p $out/parser
ln -s ${grammars}/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
];
}