Skip to content

When built from the flake, opencode package is extremely large (4GB+) #4853

@palekiwi

Description

@palekiwi

First off, thanks so much for the addition of the flake.nix to the repo. It's been a monumental piece of work that I absolutely rely on.

However, I've noticed that the package built from the flake.nix takes up over 4GB of space.

Below is an AI generated report that may be helpful.

Summary

The OpenCode package is 4.0 GiB, which is excessive. Investigation shows that all platform-specific optional dependencies are being bundled instead of just the required platform.

Environment

  • OpenCode version: v1.0.119
  • Package manager: Bun
  • Platform: Linux x64
  • Installation: Via Nix flake from github:sst/opencode

Issue Details

The OpenCode Nix store package is 4.0 GiB:

$ nix path-info -Sh github:sst/opencode
/nix/store/q3p8pk2qk3ydsi2fdvnjl6raiydwdgyi-opencode-1.0.119  4.0 GiB

Nearly all of this size (4.2GB) comes from node_modules/.bun/ containing platform-specific binaries for all platforms instead of just Linux x64.

Breakdown of Bloat

Platform-specific binaries (only Linux x64 needed, but all platforms included):

  • SST binaries: ~470MB total (6 platforms)

    • sst-darwin-arm64: 77M
    • sst-darwin-x64: 82M
    • sst-linux-arm64: 75M
    • sst-linux-x64: 80M ✅ (only one needed)
    • sst-win32-arm64: 75M
    • sst-win32-x64: 81M
  • Cloudflare Workerd: ~500MB total (5 platforms)

    • @cloudflare/workerd-darwin-64: 99M
    • @cloudflare/workerd-darwin-arm64: 95M
    • @cloudflare/workerd-linux-64: 112M ✅ (only one needed)
    • @cloudflare/workerd-linux-arm64: 116M
    • @cloudflare/workerd-windows-64: 80M
  • Pagefind: ~390MB total (6 platforms)

    • @pagefind/darwin-arm64: 63M
    • @pagefind/darwin-x64: 63M
    • @pagefind/freebsd-x64: 66M
    • @pagefind/linux-arm64: 65M
    • @pagefind/linux-x64: 66M ✅ (only one needed)
    • @pagefind/windows-x64: 63M
  • Turbo: ~200MB total (6 platforms)

    • turbo-darwin-64: 31M
    • turbo-darwin-arm64: 27M
    • turbo-linux-64: 33M ✅ (only one needed)
    • turbo-linux-arm64: 29M
    • turbo-windows-64: 39M
    • turbo-windows-arm64: 39M

Other large dependencies:

  • @ibm/plex fonts: 203MB
  • aws-sdk: 101MB
  • cloudflare: 53MB
  • three: 32MB

Total: 1,898 packages in node_modules/.bun/

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions