[PR #8033] fix(nix): filter optional dependencies by target platform #12597

Closed
opened 2026-02-16 18:17:29 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8033

State: closed
Merged: Yes


Summary

Fixes #8029 and #4853 by installing only platform-specific optional dependencies instead of all platforms.

Changes

  • Parse bunTarget map to extract OS and CPU for bun install flags
  • Replace --cpu="*" and --os="*" with platform-specific values
  • Support per-system node_modules hashes (different content per platform)
  • Update CI workflow to generate hashes for all platforms
  • Fail explicitly for missing hashes (no silent fallbacks)

Implementation

  • Added parseBunTarget helper to extract OS/CPU from bunTarget
  • Modified nodeModulesHashFor to support both {system: hash} and legacy single hash
  • Updated nix/hashes.json with per-system hashes (x86_64-linux, aarch64-darwin)
  • Modified update-hashes.sh script to write per-system hash format
  • Split update-nix-hashes workflow into sequential Linux + macOS jobs
  • Removed code duplication by reusing existing bunTarget map
  • Removed fallback hashes to prevent silent failures

Impact

  • Fixes "Operation not permitted" error on Windows DLLs when building on macOS/Linux (#8029)
  • Reduces package size from ~4GB to ~few hundred MB (#4853)
  • Eliminates cross-platform binary access issues in Nix build sandboxes
  • Only installs platform-specific binaries (SST, Cloudflare Workerd, Pagefind, Turbo, @opentui/core, etc.) for the target platform

Supported Systems

Currently with hashes:

  • x86_64-linux
  • aarch64-darwin

Defined but pending CI hash generation:

  • x86_64-darwin (will be generated on next dependency change)
  • aarch64-linux (will be generated on next dependency change)

Missing hashes will fail with clear Nix error instead of using wrong hash.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8033 **State:** closed **Merged:** Yes --- ## Summary Fixes #8029 and #4853 by installing only platform-specific optional dependencies instead of all platforms. ## Changes - Parse bunTarget map to extract OS and CPU for bun install flags - Replace `--cpu="*"` and `--os="*"` with platform-specific values - Support per-system node_modules hashes (different content per platform) - Update CI workflow to generate hashes for all platforms - Fail explicitly for missing hashes (no silent fallbacks) ## Implementation - Added `parseBunTarget` helper to extract OS/CPU from bunTarget - Modified `nodeModulesHashFor` to support both `{system: hash}` and legacy single hash - Updated `nix/hashes.json` with per-system hashes (x86_64-linux, aarch64-darwin) - Modified `update-hashes.sh` script to write per-system hash format - Split `update-nix-hashes` workflow into sequential Linux + macOS jobs - Removed code duplication by reusing existing bunTarget map - Removed fallback hashes to prevent silent failures ## Impact - Fixes "Operation not permitted" error on Windows DLLs when building on macOS/Linux (#8029) - Reduces package size from ~4GB to ~few hundred MB (#4853) - Eliminates cross-platform binary access issues in Nix build sandboxes - Only installs platform-specific binaries (SST, Cloudflare Workerd, Pagefind, Turbo, @opentui/core, etc.) for the target platform ## Supported Systems Currently with hashes: - `x86_64-linux` ✅ - `aarch64-darwin` ✅ Defined but pending CI hash generation: - `x86_64-darwin` (will be generated on next dependency change) - `aarch64-linux` (will be generated on next dependency change) Missing hashes will fail with clear Nix error instead of using wrong hash.
yindo added the pull-request label 2026-02-16 18:17:29 -05:00
yindo closed this issue 2026-02-16 18:17:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12597