fix(nix): relax Bun version check for desktop build (#36767)

Co-authored-by: Test User <test@test.com>
This commit is contained in:
Jérôme Benoit
2026-07-18 10:41:15 -05:00
committed by GitHub
co-authored by Test User
parent fab2133129
commit 9da9ed9de6
+17 -10
View File
@@ -42,16 +42,23 @@ stdenv.mkDerivation (finalAttrs: {
ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
}; };
# https://github.com/electron/electron/issues/31121 postPatch =
# mac builds use a .app bundle which doesnt have this issue # NOTE: Relax Bun version check to be a warning instead of an error
postPatch = lib.optionalString stdenv.isLinux '' ''
BASE_PATH=packages/desktop substituteInPlace packages/script/src/index.ts \
FILES=(src/main/windows.ts) --replace-fail 'throw new Error(`This script requires bun@''${expectedBunVersionRange}' \
for file in "''${FILES[@]}"; do 'console.warn(`Warning: This script requires bun@''${expectedBunVersionRange}'
substituteInPlace $BASE_PATH/$file \ ''
--replace-fail "process.resourcesPath" "'$out/opt/opencode-desktop/resources'" # https://github.com/electron/electron/issues/31121
done # mac builds use a .app bundle which doesnt have this issue
''; + lib.optionalString stdenv.isLinux ''
BASE_PATH=packages/desktop
FILES=(src/main/windows.ts)
for file in "''${FILES[@]}"; do
substituteInPlace $BASE_PATH/$file \
--replace-fail "process.resourcesPath" "'$out/opt/opencode-desktop/resources'"
done
'';
preBuild = '' preBuild = ''
cp -r "${electron.dist}" $HOME/.electron-dist cp -r "${electron.dist}" $HOME/.electron-dist