From 8dc5e38125ed4eb7b1a9cab2fb6bcd164f8895ec Mon Sep 17 00:00:00 2001 From: Thierry Delafontaine Date: Wed, 6 Aug 2025 22:09:45 +0200 Subject: [PATCH] opencode: refine build flags and remove unused tree-sitter dependency Synchronize the build command with `packages/opencode/script/publish.ts` by: - Adding `--define OPENCODE_TUI_PATH` to explicitly inject the TUI path during the build - Removing the `--minify` flag from the bun build command Removing the `--minify` flag resolves the error: "Cannot find module '/$bunfs/root/../../../tree-sitter-zw03zjvh.node' from '/$bunfs/root/opencode'" which occurred when letting the AI run bash commands. Fixes #430293 --- pkgs/by-name/op/opencode/package.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkgs/by-name/op/opencode/package.nix b/pkgs/by-name/op/opencode/package.nix index fbf8095ef1ad..d75e46322002 100644 --- a/pkgs/by-name/op/opencode/package.nix +++ b/pkgs/by-name/op/opencode/package.nix @@ -7,7 +7,6 @@ models-dev, nix-update-script, testers, - tree-sitter, writableTmpDirAsHomeHook, }: @@ -108,8 +107,6 @@ stdenvNoCC.mkDerivation (finalAttrs: { outputHashMode = "recursive"; }; - buildInputs = [ tree-sitter ]; - nativeBuildInputs = [ bun models-dev @@ -135,13 +132,12 @@ stdenvNoCC.mkDerivation (finalAttrs: { runHook preBuild bun build \ + --define OPENCODE_TUI_PATH="'${finalAttrs.tui}/bin/tui'" \ --define OPENCODE_VERSION="'${finalAttrs.version}'" \ --compile \ - --minify \ --target=${bun-target.${stdenvNoCC.hostPlatform.system}} \ --outfile=opencode \ ./packages/opencode/src/index.ts \ - ${finalAttrs.tui}/bin/tui runHook postBuild '';