summary refs log tree commit diff
path: root/pkgs/development/tools/parsing
diff options
context:
space:
mode:
authorGlib Shpychka <23005347+gshpychka@users.noreply.github.com>2023-06-26 18:36:03 +0300
committerGlib Shpychka <23005347+gshpychka@users.noreply.github.com>2023-06-26 18:36:03 +0300
commitce10c78c78be3da75d2856a84e5d3968746d05c7 (patch)
treedeb048fc77441a45d8525bd1cd936e6122f4947e /pkgs/development/tools/parsing
parentcdefe1d0830ccac378c48eeed795860cf0ded9c3 (diff)
downloadnixpkgs-ce10c78c78be3da75d2856a84e5d3968746d05c7.tar
nixpkgs-ce10c78c78be3da75d2856a84e5d3968746d05c7.tar.gz
nixpkgs-ce10c78c78be3da75d2856a84e5d3968746d05c7.tar.bz2
nixpkgs-ce10c78c78be3da75d2856a84e5d3968746d05c7.tar.lz
nixpkgs-ce10c78c78be3da75d2856a84e5d3968746d05c7.tar.xz
nixpkgs-ce10c78c78be3da75d2856a84e5d3968746d05c7.tar.zst
nixpkgs-ce10c78c78be3da75d2856a84e5d3968746d05c7.zip
tree-sitter: allow use of 'generate' argument
Diffstat (limited to 'pkgs/development/tools/parsing')
-rw-r--r--pkgs/development/tools/parsing/tree-sitter/default.nix5
-rw-r--r--pkgs/development/tools/parsing/tree-sitter/grammar.nix6
2 files changed, 6 insertions, 5 deletions
diff --git a/pkgs/development/tools/parsing/tree-sitter/default.nix b/pkgs/development/tools/parsing/tree-sitter/default.nix
index 9da09a10e7e..6579a039b70 100644
--- a/pkgs/development/tools/parsing/tree-sitter/default.nix
+++ b/pkgs/development/tools/parsing/tree-sitter/default.nix
@@ -41,7 +41,7 @@ let
     fetchSubmodules = true;
   };
 
-  update-all-grammars = callPackage ./update.nix {};
+  update-all-grammars = callPackage ./update.nix { };
 
   fetchGrammar = (v: fetchgit { inherit (v) url rev sha256 fetchSubmodules; });
 
@@ -62,6 +62,7 @@ let
           inherit version;
           src = grammar.src or (fetchGrammar grammar);
           location = grammar.location or null;
+          generate = grammar.generate or false;
         };
       grammars' = import ./grammars { inherit lib; } // extraGrammars;
       grammars = grammars' //
@@ -111,7 +112,7 @@ rustPlatform.buildRustPackage {
   inherit src version cargoSha256;
 
   buildInputs =
-    lib.optionals stdenv.isDarwin [ Security CoreServices];
+    lib.optionals stdenv.isDarwin [ Security CoreServices ];
   nativeBuildInputs =
     [ which ]
     ++ lib.optionals webUISupport [ emscripten ];
diff --git a/pkgs/development/tools/parsing/tree-sitter/grammar.nix b/pkgs/development/tools/parsing/tree-sitter/grammar.nix
index c2c3ce4a896..ce46e3623ba 100644
--- a/pkgs/development/tools/parsing/tree-sitter/grammar.nix
+++ b/pkgs/development/tools/parsing/tree-sitter/grammar.nix
@@ -28,10 +28,10 @@ stdenv.mkDerivation ({
 
   stripDebugList = [ "parser" ];
 
-  configurePhase = lib.optionalString generate ''
-    tree-sitter generate
-  '' + lib.optionalString (location != null) ''
+  configurePhase = lib.optionalString (location != null) ''
     cd ${location}
+  '' + lib.optionalString generate ''
+    tree-sitter generate
   '';
 
   # When both scanner.{c,cc} exist, we should not link both since they may be the same but in