tree-sitter-d2/dev/nvim-ts.nix

66 lines
1.3 KiB
Nix
Raw Normal View History

2022-12-07 13:57:13 +03:00
{ pkgs ? import <nixpkgs> { } }:
let
2022-12-07 17:14:44 +03:00
extraGrammars = {
tree-sitter-d2 = {
language = "d2";
src = ../.;
version = "0.0.0";
2022-12-07 13:57:13 +03:00
};
};
2022-12-07 17:14:44 +03:00
tree-sitter = (pkgs.tree-sitter.override { inherit extraGrammars; });
2022-12-09 18:21:55 +03:00
grammars = tree-sitter.withPlugins (g: tree-sitter.allGrammars);
2022-12-07 17:14:44 +03:00
nvim-treesitter = pkgs.vimPlugins.nvim-treesitter.overrideAttrs (oldAttrs: {
postPatch = ''
rm -r parser
ln -s ${grammars} parser
ln -s ${../.}/queries queries/d2
'';
});
luaRc = ''
2022-12-13 16:42:07 +03:00
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
2022-12-07 17:14:44 +03:00
parser_config.d2 = {}
require("nvim-treesitter.configs").setup({
ensure_installed = { },
sync_install = false,
highlight = {
enable = true,
},
indent = {
enable = true,
},
})
vim.g.catppuccin_flavour = "frappe"
require("catppuccin").setup()
vim.cmd([[colorscheme catppuccin]])
2022-12-07 17:14:44 +03:00
'';
2022-12-07 13:57:13 +03:00
neovim = pkgs.neovim.override {
configure = {
customRC = ''
source ${./vimrc.vim}
2022-12-07 17:14:44 +03:00
lua <<EOF
${luaRc}
EOF
2022-12-07 13:57:13 +03:00
'';
packages.myPlugins.start = with pkgs.vimPlugins; [
2022-12-07 13:57:13 +03:00
nvim-treesitter
catppuccin-nvim
2022-12-07 13:57:13 +03:00
];
};
};
in
pkgs.runCommand "nvim-ts" { } ''
mkdir -p $out/bin
ln -s ${neovim}/bin/nvim $out/bin/nvim-ts
''