Loading pkgs/applications/editors/neovim/default.nix +14 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ , unibilium, gperf , libvterm-neovim , tree-sitter , fetchurl , treesitter-parsers ? import ./treesitter-parsers.nix { inherit fetchurl; } , CoreServices , glibcLocales ? null, procps ? null Loading Loading @@ -119,7 +121,18 @@ in ) '' + lib.optionalString stdenv.isDarwin '' substituteInPlace src/nvim/CMakeLists.txt --replace " util" "" ''; '' + '' mkdir -p $out/lib/nvim/parser '' + lib.concatStrings (lib.mapAttrsToList (language: src: '' ln -s \ ${tree-sitter.buildGrammar { inherit language src; version = "neovim-${version}"; }}/parser \ $out/lib/nvim/parser/${language}.so '') treesitter-parsers); shellHook='' export VIMRUNTIME=$PWD/runtime Loading pkgs/applications/editors/neovim/treesitter-parsers.nix 0 → 100644 +24 −0 Original line number Diff line number Diff line { fetchurl }: { c = fetchurl { url = "https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.2.tar.gz"; hash = "sha256:af66fde03feb0df4faf03750102a0d265b007e5d957057b6b293c13116a70af2"; }; lua = fetchurl { url = "https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.14.tar.gz"; hash = "sha256:930d0370dc15b66389869355c8e14305b9ba7aafd36edbfdb468c8023395016d"; }; vim = fetchurl { url = "https://github.com/neovim/tree-sitter-vim/archive/v0.3.0.tar.gz"; hash = "sha256:403acec3efb7cdb18ff3d68640fc823502a4ffcdfbb71cec3f98aa786c21cbe2"; }; vimdoc = fetchurl { url = "https://github.com/neovim/tree-sitter-vimdoc/archive/v2.0.0.tar.gz"; hash = "sha256:1ff8f4afd3a9599dd4c3ce87c155660b078c1229704d1a254433e33794b8f274"; }; query = fetchurl { url = "https://github.com/nvim-treesitter/tree-sitter-query/archive/v0.1.0.tar.gz"; hash = "sha256:e2b806f80e8bf1c4f4e5a96248393fe6622fc1fc6189d6896d269658f67f914c"; }; } pkgs/applications/editors/neovim/update-treesitter-parsers.py 0 → 100755 +46 −0 Original line number Diff line number Diff line #!/usr/bin/env nix-shell #!nix-shell -i python3 -p python3 import re import subprocess from pathlib import Path parsers = {} dir = Path(__file__).parent regex = re.compile(r"^set\(TREESITTER_([A-Z_]+)_(URL|SHA256)\s+([^ \)]+)\s*\)\s*$") src = subprocess.check_output( [ "nix-build", dir.parent.parent.parent.parent, "-A", "neovim-unwrapped.src", "--no-out-link", ], text=True, ).strip() for line in open(f"{src}/cmake.deps/CMakeLists.txt"): m = regex.fullmatch(line) if m is None: continue lang = m[1].lower() ty = m[2] val = m[3] if not lang in parsers: parsers[lang] = {} parsers[lang][ty] = val with open(dir / "treesitter-parsers.nix", "w") as f: f.write("{ fetchurl }:\n\n{\n") for lang, src in parsers.items(): f.write( f""" {lang} = fetchurl {{ url = "{src["URL"]}"; hash = "sha256:{src["SHA256"]}"; }}; """ ) f.write("}\n") Loading
pkgs/applications/editors/neovim/default.nix +14 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ , unibilium, gperf , libvterm-neovim , tree-sitter , fetchurl , treesitter-parsers ? import ./treesitter-parsers.nix { inherit fetchurl; } , CoreServices , glibcLocales ? null, procps ? null Loading Loading @@ -119,7 +121,18 @@ in ) '' + lib.optionalString stdenv.isDarwin '' substituteInPlace src/nvim/CMakeLists.txt --replace " util" "" ''; '' + '' mkdir -p $out/lib/nvim/parser '' + lib.concatStrings (lib.mapAttrsToList (language: src: '' ln -s \ ${tree-sitter.buildGrammar { inherit language src; version = "neovim-${version}"; }}/parser \ $out/lib/nvim/parser/${language}.so '') treesitter-parsers); shellHook='' export VIMRUNTIME=$PWD/runtime Loading
pkgs/applications/editors/neovim/treesitter-parsers.nix 0 → 100644 +24 −0 Original line number Diff line number Diff line { fetchurl }: { c = fetchurl { url = "https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.2.tar.gz"; hash = "sha256:af66fde03feb0df4faf03750102a0d265b007e5d957057b6b293c13116a70af2"; }; lua = fetchurl { url = "https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.14.tar.gz"; hash = "sha256:930d0370dc15b66389869355c8e14305b9ba7aafd36edbfdb468c8023395016d"; }; vim = fetchurl { url = "https://github.com/neovim/tree-sitter-vim/archive/v0.3.0.tar.gz"; hash = "sha256:403acec3efb7cdb18ff3d68640fc823502a4ffcdfbb71cec3f98aa786c21cbe2"; }; vimdoc = fetchurl { url = "https://github.com/neovim/tree-sitter-vimdoc/archive/v2.0.0.tar.gz"; hash = "sha256:1ff8f4afd3a9599dd4c3ce87c155660b078c1229704d1a254433e33794b8f274"; }; query = fetchurl { url = "https://github.com/nvim-treesitter/tree-sitter-query/archive/v0.1.0.tar.gz"; hash = "sha256:e2b806f80e8bf1c4f4e5a96248393fe6622fc1fc6189d6896d269658f67f914c"; }; }
pkgs/applications/editors/neovim/update-treesitter-parsers.py 0 → 100755 +46 −0 Original line number Diff line number Diff line #!/usr/bin/env nix-shell #!nix-shell -i python3 -p python3 import re import subprocess from pathlib import Path parsers = {} dir = Path(__file__).parent regex = re.compile(r"^set\(TREESITTER_([A-Z_]+)_(URL|SHA256)\s+([^ \)]+)\s*\)\s*$") src = subprocess.check_output( [ "nix-build", dir.parent.parent.parent.parent, "-A", "neovim-unwrapped.src", "--no-out-link", ], text=True, ).strip() for line in open(f"{src}/cmake.deps/CMakeLists.txt"): m = regex.fullmatch(line) if m is None: continue lang = m[1].lower() ty = m[2] val = m[3] if not lang in parsers: parsers[lang] = {} parsers[lang][ty] = val with open(dir / "treesitter-parsers.nix", "w") as f: f.write("{ fetchurl }:\n\n{\n") for lang, src in parsers.items(): f.write( f""" {lang} = fetchurl {{ url = "{src["URL"]}"; hash = "sha256:{src["SHA256"]}"; }}; """ ) f.write("}\n")