nix: use nvim-treesitter from nixpkgs

This commit is contained in:
Dmitriy Pleshevskiy 2022-11-26 13:25:19 +03:00
parent dc805ab062
commit d991c749c2
Signed by: pleshevskiy
GPG Key ID: 1B59187B161C0215
3 changed files with 9 additions and 49 deletions

View File

@ -202,11 +202,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1668852955,
"narHash": "sha256-1ozaNW9uFRvm3cP9M6FPx+hdqyFQnf49M3HrLQ6nqrk=",
"lastModified": 1669387357,
"narHash": "sha256-z1azVj/5Em5kGhh9OgBOsjTEgMab7hXL/aRilH9tzyI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2fb6f9fb0ef3ca727cbd9ae30b90d1ce49d5fcca",
"rev": "55b3f68bda6d4f4dc6092eed0508063f154fa4fd",
"type": "github"
},
"original": {
@ -301,22 +301,6 @@
"type": "github"
}
},
"nvim-treesitter": {
"flake": false,
"locked": {
"lastModified": 1668872733,
"narHash": "sha256-taM3HGP0BD1bOzFu4TF9iDT2EhoohV2FkXy0/TVbIDg=",
"owner": "nvim-treesitter",
"repo": "nvim-treesitter",
"rev": "24caa23402247cf03cfcdd54de8cdb8ed00690ba",
"type": "github"
},
"original": {
"owner": "nvim-treesitter",
"repo": "nvim-treesitter",
"type": "github"
}
},
"nvim-web-devicons": {
"flake": false,
"locked": {
@ -386,7 +370,6 @@
"nvim-lspconfig": "nvim-lspconfig",
"nvim-orgmode": "nvim-orgmode",
"nvim-tree-lua": "nvim-tree-lua",
"nvim-treesitter": "nvim-treesitter",
"nvim-web-devicons": "nvim-web-devicons",
"org-bullets-nvim": "org-bullets-nvim",
"plenary-nvim": "plenary-nvim",

View File

@ -99,14 +99,6 @@
flake = false;
};
# syntax
# https://github.com/nvim-treesitter/nvim-treesitter
nvim-treesitter = {
url = "github:nvim-treesitter/nvim-treesitter";
flake = false;
};
# theme
# https://github.com/nanozuki/tabby.nvim
@ -182,8 +174,6 @@
"nvim-cmp"
"cmp-nvim-lsp"
"cmp-luasnip"
# syntax
"nvim-treesitter"
# theme
"tabby-nvim"
"lualine-nvim"
@ -214,7 +204,9 @@
buildPluginValuePair = n: nameValuePair n (buildPlugin n);
neovimPlugins = (listToAttrs (map buildPluginValuePair inputPlugins));
neovimPlugins = (listToAttrs (map buildPluginValuePair inputPlugins)) // {
inherit (vimPlugins) nvim-treesitter;
};
in
{
inherit neovimPlugins;

View File

@ -1,6 +1,5 @@
{ lib
, nvim-treesitter
, tree-sitter
, grammarFileTypes
, ...
}:
@ -9,28 +8,14 @@
let
inherit (builtins) readFile;
extraGrammars = {
tree-sitter-org = lib.importJSON ./tree-sitter-org-nvim.json // { language = "org"; };
};
extended-treesitter = tree-sitter.override { inherit extraGrammars; };
treeSitterGrammars = extended-treesitter.withPlugins (
grammars: map (ft: grammars."tree-sitter-${ft}") grammarFileTypes
);
nvim-treesitter-with-grammars = nvim-treesitter.overrideAttrs (oldAttrs: {
postPatch = ''
rm -r parser
ln -s ${treeSitterGrammars} parser
'';
});
nvimTreesitterWithGrammars = nvim-treesitter.withPlugins
(plugins: map (ft: plugins.${ft}) grammarFileTypes);
in
{
luaConfig = readFile ./treesitter.lua;
plugins = [
nvim-treesitter-with-grammars
nvimTreesitterWithGrammars
];
}