diff --git a/pkgs/development/tools/parsing/tree-sitter/default.nix b/pkgs/development/tools/parsing/tree-sitter/default.nix index c3bdca43f36a..a481b11d95fe 100644 --- a/pkgs/development/tools/parsing/tree-sitter/default.nix +++ b/pkgs/development/tools/parsing/tree-sitter/default.nix @@ -28,7 +28,7 @@ let # to update: # 1) change all these hashes # 2) nix-build -A tree-sitter.updater.update-all-grammars - # 3) Set NIXPKGS_GITHUB_TOKEN env variable to avoid api rate limit (Use a Personal Access Token from https://github.com/settings/tokens It does not need any permissions) + # 3) Set GITHUB_TOKEN env variable to avoid api rate limit (Use a Personal Access Token from https://github.com/settings/tokens It does not need any permissions) # 4) run the ./result script that is output by that (it updates ./grammars) version = "0.25.3"; hash = "sha256-xafeni6Z6QgPiKzvhCT2SyfPn0agLHo47y+6ExQXkzE="; @@ -43,7 +43,7 @@ let update-all-grammars = callPackage ./update.nix { }; - fetchGrammar = ( + fetchGrammar = v: fetchgit { inherit (v) @@ -52,8 +52,7 @@ let sha256 fetchSubmodules ; - } - ); + }; grammars = runCommand "grammars" { } ( '' @@ -61,7 +60,7 @@ let '' + (lib.concatStrings ( lib.mapAttrsToList ( - name: grammar: "ln -s ${if grammar ? src then grammar.src else fetchGrammar grammar} $out/${name}\n" + name: grammar: "ln -s ${grammar.src or (fetchGrammar grammar)} $out/${name}\n" ) (import ./grammars { inherit lib; }) )) ); @@ -134,7 +133,7 @@ let }; }; in - lib.mapAttrs build (grammars); + lib.mapAttrs build grammars; # Usage: # pkgs.tree-sitter.withPlugins (p: [ p.tree-sitter-c p.tree-sitter-java ... ]) diff --git a/pkgs/development/tools/parsing/tree-sitter/update.nix b/pkgs/development/tools/parsing/tree-sitter/update.nix index bd6d3e51b210..c4e35962db3b 100644 --- a/pkgs/development/tools/parsing/tree-sitter/update.nix +++ b/pkgs/development/tools/parsing/tree-sitter/update.nix @@ -578,15 +578,13 @@ let } ${updateImpl} print-all-grammars-nix-file "$(< ${ jsonFile "all-grammars.json" { - allGrammars = ( - lib.mapAttrsToList ( - nixRepoAttrName: attrs: - attrs - // { - inherit nixRepoAttrName; - } - ) allGrammars - ); + allGrammars = lib.mapAttrsToList ( + nixRepoAttrName: attrs: + attrs + // { + inherit nixRepoAttrName; + } + ) allGrammars; inherit outputDir; } })"