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

View File

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

View File

@ -1,6 +1,5 @@
{ lib { lib
, nvim-treesitter , nvim-treesitter
, tree-sitter
, grammarFileTypes , grammarFileTypes
, ... , ...
}: }:
@ -9,28 +8,14 @@
let let
inherit (builtins) readFile; inherit (builtins) readFile;
extraGrammars = { nvimTreesitterWithGrammars = nvim-treesitter.withPlugins
tree-sitter-org = lib.importJSON ./tree-sitter-org-nvim.json // { language = "org"; }; (plugins: map (ft: plugins.${ft}) grammarFileTypes);
};
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
'';
});
in in
{ {
luaConfig = readFile ./treesitter.lua; luaConfig = readFile ./treesitter.lua;
plugins = [ plugins = [
nvim-treesitter-with-grammars nvimTreesitterWithGrammars
]; ];
} }