From d991c749c25f4d3719cdf90f8047af102460152c Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sat, 26 Nov 2022 13:25:19 +0300 Subject: [PATCH] nix: use nvim-treesitter from nixpkgs --- flake.lock | 23 +++-------------------- flake.nix | 14 +++----------- plugins/syntax/default.nix | 21 +++------------------ 3 files changed, 9 insertions(+), 49 deletions(-) diff --git a/flake.lock b/flake.lock index c525e1a..55e03b8 100644 --- a/flake.lock +++ b/flake.lock @@ -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", diff --git a/flake.nix b/flake.nix index 51742fc..95d4ea6 100644 --- a/flake.nix +++ b/flake.nix @@ -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; diff --git a/plugins/syntax/default.nix b/plugins/syntax/default.nix index a842066..9ade5a1 100644 --- a/plugins/syntax/default.nix +++ b/plugins/syntax/default.nix @@ -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 ]; }