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 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 = "9e60a469c5b67899f3ace13f32a43abc0ba74ec4";
sha256 = "sha256-FC2AP1DqeetfrjhSdp2QWHbW0qylImc4PeQXPvg7uT8=";
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
];
}