From a611b0ab69fb08eacc24eaf98cd280495e9a068a Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 16 Mar 2025 21:19:16 -0400 Subject: [PATCH] move tree-sitter packages out of flake --- flake.lock | 122 ------------------ flake.nix | 111 +++------------- overlays/tree-sitter.nix | 43 ------ .../neovim/nmasur/neovim/config/syntax.nix | 38 +++--- .../grammars/tree-sitter-ini/package.nix | 12 ++ .../grammars/tree-sitter-puppet/package.nix | 12 ++ .../grammars/tree-sitter-rasi/package.nix | 12 ++ .../grammars/tree-sitter-vimdoc/package.nix | 12 ++ 8 files changed, 81 insertions(+), 281 deletions(-) delete mode 100644 overlays/tree-sitter.nix create mode 100644 pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ini/package.nix create mode 100644 pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-puppet/package.nix create mode 100644 pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-rasi/package.nix create mode 100644 pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-vimdoc/package.nix diff --git a/flake.lock b/flake.lock index af445c0..43ca9c7 100644 --- a/flake.lock +++ b/flake.lock @@ -371,13 +371,6 @@ "nixpkgs": "nixpkgs", "nixpkgs-stable": "nixpkgs-stable", "nur": "nur", - "tree-sitter-bash": "tree-sitter-bash", - "tree-sitter-ini": "tree-sitter-ini", - "tree-sitter-lua": "tree-sitter-lua", - "tree-sitter-puppet": "tree-sitter-puppet", - "tree-sitter-python": "tree-sitter-python", - "tree-sitter-rasi": "tree-sitter-rasi", - "tree-sitter-vimdoc": "tree-sitter-vimdoc", "wsl": "wsl", "zenyd-mpv-scripts": "zenyd-mpv-scripts" } @@ -412,121 +405,6 @@ "type": "github" } }, - "tree-sitter-bash": { - "flake": false, - "locked": { - "lastModified": 1738310128, - "narHash": "sha256-ODWgFpCLLPgzNYXFhfAVvDXPr5bW8/49ezsaS9MOWMk=", - "owner": "tree-sitter", - "repo": "tree-sitter-bash", - "rev": "0c46d792d54c536be5ff7eb18eb95c70fccdb232", - "type": "github" - }, - "original": { - "owner": "tree-sitter", - "ref": "master", - "repo": "tree-sitter-bash", - "type": "github" - } - }, - "tree-sitter-ini": { - "flake": false, - "locked": { - "lastModified": 1741697356, - "narHash": "sha256-kWCaOIC81GP5EHCqzPZP9EUgYy39CZ6/8TVS6soB6Wo=", - "owner": "justinmk", - "repo": "tree-sitter-ini", - "rev": "32b31863f222bf22eb43b07d4e9be8017e36fb31", - "type": "github" - }, - "original": { - "owner": "justinmk", - "repo": "tree-sitter-ini", - "type": "github" - } - }, - "tree-sitter-lua": { - "flake": false, - "locked": { - "lastModified": 1738303275, - "narHash": "sha256-mE84uI5AKbLvX5CM7NvA59Z8Ux+QFdqVjZf4hi06NAM=", - "owner": "MunifTanjim", - "repo": "tree-sitter-lua", - "rev": "68d29aa745b68ae22cbbdb5dcb68c20232521ff6", - "type": "github" - }, - "original": { - "owner": "MunifTanjim", - "ref": "main", - "repo": "tree-sitter-lua", - "type": "github" - } - }, - "tree-sitter-puppet": { - "flake": false, - "locked": { - "lastModified": 1734835631, - "narHash": "sha256-bO5g5AdhzpB13yHklpAndUHIX7Rvd7OMjH0Ds2ATA6Q=", - "owner": "amaanq", - "repo": "tree-sitter-puppet", - "rev": "15f192929b7d317f5914de2b4accd37b349182a6", - "type": "github" - }, - "original": { - "owner": "amaanq", - "repo": "tree-sitter-puppet", - "type": "github" - } - }, - "tree-sitter-python": { - "flake": false, - "locked": { - "lastModified": 1738275152, - "narHash": "sha256-t9etfZcrliF7f9hfiomh2U9P+3ufAm8iSK1y9rOhP7s=", - "owner": "tree-sitter", - "repo": "tree-sitter-python", - "rev": "710796b8b877a970297106e5bbc8e2afa47f86ec", - "type": "github" - }, - "original": { - "owner": "tree-sitter", - "ref": "master", - "repo": "tree-sitter-python", - "type": "github" - } - }, - "tree-sitter-rasi": { - "flake": false, - "locked": { - "lastModified": 1716296585, - "narHash": "sha256-sPrIVgGGaBaXeqHNxjcdJ/S2FvxyV6rD9UPKU/tpspw=", - "owner": "Fymyte", - "repo": "tree-sitter-rasi", - "rev": "6c9bbcfdf5f0f553d9ebc01750a3aa247a37b8aa", - "type": "github" - }, - "original": { - "owner": "Fymyte", - "repo": "tree-sitter-rasi", - "type": "github" - } - }, - "tree-sitter-vimdoc": { - "flake": false, - "locked": { - "lastModified": 1729686839, - "narHash": "sha256-Vrl4/cZL+TWlUMEeWZoHCAWhvlefcl3ajGcwyTNKOhI=", - "owner": "neovim", - "repo": "tree-sitter-vimdoc", - "rev": "d2e4b5c172a109966c2ce0378f73df6cede39400", - "type": "github" - }, - "original": { - "owner": "neovim", - "repo": "tree-sitter-vimdoc", - "type": "github" - } - }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 1cfd968..f83c2fa 100644 --- a/flake.nix +++ b/flake.nix @@ -34,12 +34,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - # # Use official Firefox binary for macOS - # firefox-darwin = { - # url = "github:bandithedoge/nixpkgs-firefox-darwin"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; - # Better App install management in macOS mac-app-util = { url = "github:hraban/mac-app-util"; @@ -52,12 +46,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - # # Wallpapers - # wallpapers = { - # url = "gitlab:exorcist365/wallpapers"; - # flake = false; - # }; - # Used to generate NixOS images for other platforms nixos-generators = { url = "github:nix-community/nixos-generators"; @@ -70,104 +58,35 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - # # Neovim plugins - # base16-nvim-src = { - # url = "github:RRethy/base16-nvim"; + # # Tree-Sitter Grammars + # tree-sitter-bash = { + # url = "github:tree-sitter/tree-sitter-bash/master"; # flake = false; # }; - # nvim-lspconfig-src = { - # # https://github.com/neovim/nvim-lspconfig/tags - # url = "github:neovim/nvim-lspconfig/v0.1.8"; + # tree-sitter-python = { + # url = "github:tree-sitter/tree-sitter-python/master"; # flake = false; # }; - # cmp-nvim-lsp-src = { - # url = "github:hrsh7th/cmp-nvim-lsp"; + # tree-sitter-lua = { + # url = "github:MunifTanjim/tree-sitter-lua/main"; # flake = false; # }; - # baleia-nvim-src = { - # # https://github.com/m00qek/baleia.nvim/tags - # url = "github:m00qek/baleia.nvim"; + # tree-sitter-ini = { + # url = "github:justinmk/tree-sitter-ini"; # flake = false; # }; - # nvim-treesitter-src = { - # # https://github.com/nvim-treesitter/nvim-treesitter/tags - # url = "github:nvim-treesitter/nvim-treesitter/v0.9.2"; + # tree-sitter-puppet = { + # url = "github:amaanq/tree-sitter-puppet"; # flake = false; # }; - # telescope-nvim-src = { - # # https://github.com/nvim-telescope/telescope.nvim/releases - # url = "github:nvim-telescope/telescope.nvim/0.1.8"; + # tree-sitter-rasi = { + # url = "github:Fymyte/tree-sitter-rasi"; # flake = false; # }; - # telescope-project-nvim-src = { - # url = "github:nvim-telescope/telescope-project.nvim"; + # tree-sitter-vimdoc = { + # url = "github:neovim/tree-sitter-vimdoc"; # flake = false; # }; - # toggleterm-nvim-src = { - # # https://github.com/akinsho/toggleterm.nvim/tags - # url = "github:akinsho/toggleterm.nvim/v2.12.0"; - # flake = false; - # }; - # bufferline-nvim-src = { - # # https://github.com/akinsho/bufferline.nvim/releases - # url = "github:akinsho/bufferline.nvim/v4.6.1"; - # flake = false; - # }; - # nvim-tree-lua-src = { - # url = "github:kyazdani42/nvim-tree.lua"; - # flake = false; - # }; - # hmts-nvim-src = { - # url = "github:calops/hmts.nvim"; - # flake = false; - # }; - # fidget-nvim-src = { - # # https://github.com/j-hui/fidget.nvim/tags - # url = "github:j-hui/fidget.nvim/v1.4.5"; - # flake = false; - # }; - # nvim-lint-src = { - # url = "github:mfussenegger/nvim-lint"; - # flake = false; - # }; - # tiny-inline-diagnostic-nvim-src = { - # url = "github:rachartier/tiny-inline-diagnostic.nvim"; - # flake = false; - # }; - # snipe-nvim-src = { - # url = "github:leath-dub/snipe.nvim"; - # flake = false; - # }; - - # Tree-Sitter Grammars - tree-sitter-bash = { - url = "github:tree-sitter/tree-sitter-bash/master"; - flake = false; - }; - tree-sitter-python = { - url = "github:tree-sitter/tree-sitter-python/master"; - flake = false; - }; - tree-sitter-lua = { - url = "github:MunifTanjim/tree-sitter-lua/main"; - flake = false; - }; - tree-sitter-ini = { - url = "github:justinmk/tree-sitter-ini"; - flake = false; - }; - tree-sitter-puppet = { - url = "github:amaanq/tree-sitter-puppet"; - flake = false; - }; - tree-sitter-rasi = { - url = "github:Fymyte/tree-sitter-rasi"; - flake = false; - }; - tree-sitter-vimdoc = { - url = "github:neovim/tree-sitter-vimdoc"; - flake = false; - }; # MPV Scripts zenyd-mpv-scripts = { diff --git a/overlays/tree-sitter.nix b/overlays/tree-sitter.nix deleted file mode 100644 index 148fb98..0000000 --- a/overlays/tree-sitter.nix +++ /dev/null @@ -1,43 +0,0 @@ -inputs: _final: prev: { - tree-sitter-grammars = prev.tree-sitter-grammars // { - - # Fix: bash highlighting doesn't work as of this commit: - # https://github.com/NixOS/nixpkgs/commit/49cce41b7c5f6b88570a482355d9655ca19c1029 - tree-sitter-bash = prev.tree-sitter-grammars.tree-sitter-bash.overrideAttrs (old: { - src = inputs.tree-sitter-bash; - }); - - # Fix: invalid node in position. Broken as of this commit (replaced with newer): - # https://github.com/NixOS/nixpkgs/commit/8ec3627796ecc899e6f47f5bf3c3220856ead9c5 - tree-sitter-python = prev.tree-sitter-grammars.tree-sitter-python.overrideAttrs (old: { - src = inputs.tree-sitter-python; - }); - - # Fix: invalid structure in position. - tree-sitter-lua = prev.tree-sitter-grammars.tree-sitter-lua.overrideAttrs (old: { - src = inputs.tree-sitter-lua; - }); - - # Add grammars not in nixpks - tree-sitter-ini = prev.tree-sitter.buildGrammar { - language = "ini"; - version = "1.0.0"; - src = inputs.tree-sitter-ini; - }; - tree-sitter-puppet = prev.tree-sitter.buildGrammar { - language = "puppet"; - version = "1.0.0"; - src = inputs.tree-sitter-puppet; - }; - tree-sitter-rasi = prev.tree-sitter.buildGrammar { - language = "rasi"; - version = "0.1.1"; - src = inputs.tree-sitter-rasi; - }; - tree-sitter-vimdoc = prev.tree-sitter.buildGrammar { - language = "vimdoc"; - version = "2.1.0"; - src = inputs.tree-sitter-vimdoc; - }; - }; -} diff --git a/pkgs/applications/editors/neovim/nmasur/neovim/config/syntax.nix b/pkgs/applications/editors/neovim/nmasur/neovim/config/syntax.nix index c014209..6fc64a6 100644 --- a/pkgs/applications/editors/neovim/nmasur/neovim/config/syntax.nix +++ b/pkgs/applications/editors/neovim/nmasur/neovim/config/syntax.nix @@ -2,26 +2,24 @@ { plugins = [ - (pkgs.vimPlugins.nvim-treesitter.withPlugins ( - _plugins: with pkgs.tree-sitter-grammars; [ - tree-sitter-bash - tree-sitter-c - tree-sitter-fish - tree-sitter-hcl - tree-sitter-ini - tree-sitter-json - tree-sitter-lua - tree-sitter-markdown - tree-sitter-markdown-inline - tree-sitter-nix - tree-sitter-puppet - tree-sitter-python - tree-sitter-rasi - tree-sitter-toml - tree-sitter-vimdoc - tree-sitter-yaml - ] - )) + (pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins: [ + pkgs.nmasur.ini-grammar + pkgs.nmasur.puppet-grammar + pkgs.nmasur.rasi-grammar + pkgs.nmasur.vimdoc-grammar + pkgs.tree-sitter-grammars.tree-sitter-bash + pkgs.tree-sitter-grammars.tree-sitter-c + pkgs.tree-sitter-grammars.tree-sitter-fish + pkgs.tree-sitter-grammars.tree-sitter-hcl + pkgs.tree-sitter-grammars.tree-sitter-json + pkgs.tree-sitter-grammars.tree-sitter-lua + pkgs.tree-sitter-grammars.tree-sitter-markdown + pkgs.tree-sitter-grammars.tree-sitter-markdown-inline + pkgs.tree-sitter-grammars.tree-sitter-nix + pkgs.tree-sitter-grammars.tree-sitter-python + pkgs.tree-sitter-grammars.tree-sitter-toml + pkgs.tree-sitter-grammars.tree-sitter-yaml + ])) pkgs.vimPlugins.vim-matchup # Better % jumping in languages pkgs.vimPlugins.playground # Tree-sitter experimenting pkgs.vimPlugins.nginx-vim diff --git a/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ini/package.nix b/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ini/package.nix new file mode 100644 index 0000000..5ff1715 --- /dev/null +++ b/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ini/package.nix @@ -0,0 +1,12 @@ +{ pkgs, fetchFromGitHub }: + +pkgs.tree-sitter.buildGrammar { + language = "ini"; + version = "1.3.0"; + src = fetchFromGitHub { + owner = "justinmk"; + repo = "tree-sitter-ini"; + rev = "32b31863f222bf22eb43b07d4e9be8017e36fb31"; + sha256 = "sha256-kWCaOIC81GP5EHCqzPZP9EUgYy39CZ6/8TVS6soB6Wo="; + }; +} diff --git a/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-puppet/package.nix b/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-puppet/package.nix new file mode 100644 index 0000000..f0f2850 --- /dev/null +++ b/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-puppet/package.nix @@ -0,0 +1,12 @@ +{ pkgs, fetchFromGitHub }: + +pkgs.tree-sitter.buildGrammar { + language = "puppet"; + version = "1.3.0"; + src = fetchFromGitHub { + owner = "tree-sitter-grammars"; + repo = "tree-sitter-puppet"; + rev = "15f192929b7d317f5914de2b4accd37b349182a6"; + sha256 = "sha256-bO5g5AdhzpB13yHklpAndUHIX7Rvd7OMjH0Ds2ATA6Q="; + }; +} diff --git a/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-rasi/package.nix b/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-rasi/package.nix new file mode 100644 index 0000000..3962762 --- /dev/null +++ b/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-rasi/package.nix @@ -0,0 +1,12 @@ +{ pkgs, fetchFromGitHub }: + +pkgs.tree-sitter.buildGrammar { + language = "rasi"; + version = "0.1.2"; + src = fetchFromGitHub { + owner = "Fymyte"; + repo = "tree-sitter-rasi"; + rev = "6c9bbcfdf5f0f553d9ebc01750a3aa247a37b8aa"; + sha256 = "sha256-sPrIVgGGaBaXeqHNxjcdJ/S2FvxyV6rD9UPKU/tpspw="; + }; +} diff --git a/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-vimdoc/package.nix b/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-vimdoc/package.nix new file mode 100644 index 0000000..53a9173 --- /dev/null +++ b/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-vimdoc/package.nix @@ -0,0 +1,12 @@ +{ pkgs, fetchFromGitHub }: + +pkgs.tree-sitter.buildGrammar { + language = "vimdoc"; + version = "3.0.0"; + src = fetchFromGitHub { + owner = "neovim"; + repo = "tree-sitter-vimdoc"; + rev = "d2e4b5c172a109966c2ce0378f73df6cede39400"; + sha256 = "sha256-Vrl4/cZL+TWlUMEeWZoHCAWhvlefcl3ajGcwyTNKOhI="; + }; +}