vimPlugins.nvim-treesitter: switch to nurl in update script

figsoda b12686d5 67b0f840

+7 -48
+1 -1
pkgs/applications/editors/vim/plugins/nvim-treesitter/generated.nix
··· 1 # generated by pkgs/applications/editors/vim/plugins/nvim-treesitter/update.py 2 3 - { buildGrammar, fetchFromGitHub, fetchFromGitLab, fetchgit }: 4 5 { 6 ada = buildGrammar {
··· 1 # generated by pkgs/applications/editors/vim/plugins/nvim-treesitter/update.py 2 3 + { buildGrammar, fetchFromGitHub, fetchFromGitLab, fetchFromSourcehut, fetchgit }: 4 5 { 6 ada = buildGrammar {
+1 -1
pkgs/applications/editors/vim/plugins/nvim-treesitter/update-shell.nix
··· 11 in 12 13 mkShell { 14 - packages = [ neovim nix-prefetch python3 ]; 15 16 NVIM_TREESITTER = nvim-treesitter; 17 }
··· 11 in 12 13 mkShell { 14 + packages = [ neovim nurl python3 ]; 15 16 NVIM_TREESITTER = nvim-treesitter; 17 }
+5 -46
pkgs/applications/editors/vim/plugins/nvim-treesitter/update.py
··· 2 #!nix-shell update-shell.nix -i python 3 4 import json 5 - import re 6 import subprocess 7 from os import environ 8 from os.path import dirname, join 9 ··· 21 ] 22 ) 23 ) 24 - 25 - regex = re.compile("^https?://(github.com|gitlab.com)/(.+?)/(.+?)(.git)?$") 26 27 28 def generate_grammar(item): ··· 40 version = "{rev[:7]}"; 41 source = """ 42 43 - m = regex.fullmatch(url) 44 - cmd = ["nix-prefetch", "--rev", rev] 45 - 46 - match m and m.group(1, 2, 3): 47 - case "github.com", owner, repo: 48 - cmd += [ 49 - "fetchFromGitHub", 50 - "--owner", 51 - owner, 52 - "--repo", 53 - repo, 54 - ] 55 - 56 - generated += f"""fetchFromGitHub {{ 57 - owner = "{owner}"; 58 - repo = "{repo}";""" 59 - 60 - case "gitlab.com", owner, repo: 61 - cmd += [ 62 - "fetchFromGitLab", 63 - "--owner", 64 - owner, 65 - "--repo", 66 - repo, 67 - ] 68 - 69 - generated += f"""fetchFromGitLab {{ 70 - owner = "{owner}"; 71 - repo = "{repo}";""" 72 - 73 - case _: 74 - cmd += ["fetchgit", "--url", url] 75 - generated += f"""fetchgit {{ 76 - url = "{url}";""" 77 - 78 - hash = subprocess.check_output(cmd, text=True).strip() 79 - 80 - generated += f""" 81 - rev = "{rev}"; 82 - hash = "{hash}"; 83 - }};""" 84 85 location = info.get("location") 86 if location: ··· 101 102 generated_file = """# generated by pkgs/applications/editors/vim/plugins/nvim-treesitter/update.py 103 104 - { buildGrammar, fetchFromGitHub, fetchFromGitLab, fetchgit }: 105 106 { 107 """ 108 109 - for generated in map(generate_grammar, lockfile.items()): 110 generated_file += generated 111 112 generated_file += "}\n"
··· 2 #!nix-shell update-shell.nix -i python 3 4 import json 5 import subprocess 6 + from concurrent.futures import ThreadPoolExecutor 7 from os import environ 8 from os.path import dirname, join 9 ··· 21 ] 22 ) 23 ) 24 25 26 def generate_grammar(item): ··· 38 version = "{rev[:7]}"; 39 source = """ 40 41 + generated += subprocess.check_output(["nurl", url, rev, "--indent=4"], text=True) 42 + generated += ";" 43 44 location = info.get("location") 45 if location: ··· 60 61 generated_file = """# generated by pkgs/applications/editors/vim/plugins/nvim-treesitter/update.py 62 63 + { buildGrammar, fetchFromGitHub, fetchFromGitLab, fetchFromSourcehut, fetchgit }: 64 65 { 66 """ 67 68 + for generated in ThreadPoolExecutor().map(generate_grammar, lockfile.items()): 69 generated_file += generated 70 71 generated_file += "}\n"