diff options
Diffstat (limited to 'pkgs/development/tools/parsing/tree-sitter/update.nix')
-rw-r--r-- | pkgs/development/tools/parsing/tree-sitter/update.nix | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/pkgs/development/tools/parsing/tree-sitter/update.nix b/pkgs/development/tools/parsing/tree-sitter/update.nix index 17b13bad8b0a6..055f42dc720a3 100644 --- a/pkgs/development/tools/parsing/tree-sitter/update.nix +++ b/pkgs/development/tools/parsing/tree-sitter/update.nix @@ -393,6 +393,7 @@ let curl = "${curl}/bin/curl"; nix-prefetch-git = "${nix-prefetch-git}/bin/nix-prefetch-git"; inherit atomically-write; + printf = "${coreutils}/bin/printf"; }; inherit knownTreeSitterOrgGrammarRepos @@ -446,16 +447,17 @@ let }) allGrammars) } - ${atomically-write} \ - "${outputDir}/default.nix" \ - ${writeShellScript "print-all-grammars" '' - echo "{ lib }:" - echo "{" - ${foreachSh allGrammars - ({name, ...}: '' - printf " %s = lib.importJSON ./%s.json;\n" "${name}" "${name}"'')} - echo "}" - ''} + ${fetchImpl} print-all-grammars-nix-file "$(< ${ + jsonFile "all-grammars.json" { + allGrammars = + (lib.mapAttrsToList + (nixRepoAttrName: attrs: attrs // { + inherit nixRepoAttrName; + }) + allGrammars); + inherit outputDir; + } + })" ''; # Atomically write a file (just `>` redirection in bash |