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
Raw Normal View History

2022-10-22 23:35:27 +03:00
{ lib
, runCommand
2022-12-12 21:50:03 +03:00
, fetchFromGitHub
2022-10-22 23:35:27 +03:00
, ...
2022-12-12 21:50:03 +03:00
} @ inputs:
2022-09-15 09:57:11 +03:00
2022-09-24 17:21:16 +03:00
let
2022-10-22 23:35:27 +03:00
inherit (builtins) readFile;
2022-12-12 21:50:03 +03:00
extraGrammars = {
tree-sitter-d2 = {
language = "d2";
src = fetchFromGitHub {
owner = "pleshevskiy";
repo = "tree-sitter-d2";
rev = "5459cdd0656d400ca7d104de85f5df77c90e8483";
sha256 = "sha256-TmUwK047pg6J9lyl8HQYLjN463eWuY5vlNubQOp4DL8=";
2022-12-12 21:50:03 +03:00
};
version = "0.0.0";
};
};
tree-sitter = (inputs.tree-sitter.override { inherit extraGrammars; });
grammars = tree-sitter.withPlugins (g: [ g.tree-sitter-d2 ]);
2022-12-12 21:50:03 +03:00
2022-12-13 10:09:12 +03:00
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
'')
];
2022-12-12 21:50:03 +03:00
postPatch = ''
ln -s ${extraGrammars.tree-sitter-d2.src}/queries queries/d2
2022-12-12 21:50:03 +03:00
'';
});
2022-09-24 17:21:16 +03:00
in
2022-09-15 09:57:11 +03:00
{
2022-10-22 23:35:27 +03:00
luaConfig = readFile ./treesitter.lua;
2022-09-15 09:57:11 +03:00
plugins = [
2022-12-12 21:50:03 +03:00
nvim-treesitter
2022-09-15 09:57:11 +03:00
];
}