From 06b4e995bf24a8aabc6cdab369f597332a34929e Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 14 Apr 2023 17:45:14 +0300 Subject: [PATCH] syntax: exclude unused grammars --- neovim.nix | 4 +- plugins/syntax/default.nix | 155 +++++++++++++++++++++++++++++++++++-- 2 files changed, 149 insertions(+), 10 deletions(-) diff --git a/neovim.nix b/neovim.nix index 4a0ebe5..e17176f 100644 --- a/neovim.nix +++ b/neovim.nix @@ -1,5 +1,4 @@ { enableDevIcons ? false -, enableBarBar ? false , enableTabby ? false , enableOrgMode ? false , viAlias ? false @@ -18,6 +17,7 @@ , nix2lua , substituteAll , fetchFromGitHub +, fetchFromGitea , ... }: @@ -29,7 +29,7 @@ let }; pluginParams = neovimPlugins // { - inherit runCommand tree-sitter fetchFromGitHub; + inherit runCommand tree-sitter fetchFromGitHub fetchFromGitea; inherit plugins enableDevIcons enableTabby enableOrgMode; themeCfg = theme; lib = myLib; diff --git a/plugins/syntax/default.nix b/plugins/syntax/default.nix index dd2e385..ae2ebd2 100644 --- a/plugins/syntax/default.nix +++ b/plugins/syntax/default.nix @@ -1,6 +1,5 @@ -{ lib -, runCommand -, fetchFromGitHub +{ runCommand +, fetchFromGitea , ... } @ inputs: @@ -11,10 +10,11 @@ let extraGrammars = { tree-sitter-d2 = { language = "d2"; - src = fetchFromGitHub { + src = fetchFromGitea { + domain = "git.pleshevski.ru"; owner = "pleshevskiy"; repo = "tree-sitter-d2"; - rev = "5459cdd0656d400ca7d104de85f5df77c90e8483"; + rev = "eb6910126fa392b60832d834fe6640635cd35ba8"; sha256 = "sha256-TmUwK047pg6J9lyl8HQYLjN463eWuY5vlNubQOp4DL8="; }; version = "0.0.0"; @@ -22,13 +22,152 @@ let }; tree-sitter = (inputs.tree-sitter.override { inherit extraGrammars; }); - grammars = tree-sitter.withPlugins (g: [ g.tree-sitter-d2 ]); + customGrammars = tree-sitter.withPlugins (g: [ g.tree-sitter-d2 ]); - nvim-treesitter = inputs.nvim-treesitter.withAllGrammars.overrideAttrs (oldAttrs: { + nvim-treesitter = (inputs.nvim-treesitter.withPlugins (g: [ + # g.agda + # g.arduino + # g.astro + g.awk + g.bash + # g.beancount + # g.bibtex + # g.blueprint + # g.c + # g.c_sharp + # g.clojure + g.cmake + g.comment + g.commonlisp + # g.cooklang + # g.cpp + g.css + # g.cuda + # g.d + # g.d2 + # g.dart + # g.devicetree + g.diff + g.dockerfile + # g.dot + # g.eex + # g.elixir + g.elm + # g.elvish + g.embedded_template + # g.erlang + # g.fennel + # g.fish + # g.foam + # g.fortran + # g.fusion + # g.gdscript + g.git_rebase + g.gitattributes + g.gitignore + # g.gleam + # g.glimmer + # g.glsl + # g.go + # g.godot_resource + # g.gomod + # g.gowork + g.graphql + # g.hack + g.haskell + # g.hcl + # g.heex + # g.hjson + # g.hlsl + # g.hocon + g.html + g.http + # g.java + g.javascript + g.jq + g.jsdoc + g.json + g.json5 + g.jsonc + # g.jsonnet + # g.julia + # g.kotlin + # g.lalrpop + # g.latex + g.ledger + # g.llvm + g.lua + # g.m68k + g.make + g.markdown + g.markdown_inline + # g.menhir + # g.meson + # g.nickel + # g.ninja + g.nix + # g.norg + # g.ocaml + # g.ocaml_interface + # g.ocamllex + g.org + # g.pascal + # g.perl + # g.php + # g.phpdoc + # g.pioasm + # g.prisma + # g.proto + g.pug + g.python + # g.ql + # g.qmljs + g.query + # g.r + # g.racket + # g.rasi + g.regex + # g.rego + # g.rnoweb + # g.rst + # g.ruby + g.rust + # g.scala + g.scheme + g.scss + # g.slint + # g.solidity + # g.sparql + g.sql + # g.supercollider + # g.surface + # g.svelte + # g.swift + # g.sxhkdrc + # g.teal + # g.tiger + # g.tlaplus + g.todotxt + # g.toml + # g.tsx + # g.turtle + # g.twig + g.typescript + # g.v + # g.vala + # g.verilog + # g.vhs + g.vim + g.vue + # g.wgsl + g.yaml + # g.yang + # g.zig + ])).overrideAttrs (oldAttrs: { passthru.dependencies = oldAttrs.passthru.dependencies ++ [ (runCommand "nvim-treesitter-d2-grammar" { } '' mkdir -p $out/parser - ln -s ${grammars}/d2.so $out/parser/d2.so + ln -s ${customGrammars}/d2.so $out/parser/d2.so '') ]; postPatch = ''