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
This commit is contained in:
Thierry Delafontaine 2025-08-06 22:09:45 +02:00
parent 9021b82a70
commit 8dc5e38125
No known key found for this signature in database
GPG Key ID: 00926686981863CB

View File

@ -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
'';