Skip to content

Conversation

@jerome-benoit
Copy link
Contributor

@jerome-benoit jerome-benoit commented Jan 31, 2026

Summary

  • Fix hash parsing to work on both GNU (Linux) and BSD (macOS) systems

Problem

PR #11495 introduced a regression where darwin hashes in nix/hashes.json include got: prefix (e.g., got:sha256-... instead of sha256-...).

The sed -E regex using \s+ behaves differently on BSD sed (macOS) vs GNU sed (Linux), causing the substitution to fail on darwin runners.

Ref: #11530 (comment)

Solution

Replace complex sed parsing with portable grep -oE to extract sha256 hashes directly. Use tail -n1 to get the got: hash (second match) since nix outputs specified: hash first.

Ref: #11530

The sed -E regex with \s+ behaves differently on BSD sed (macOS) vs
GNU sed (Linux), causing the hash extraction to fail on darwin runners
and include 'got:' prefix in the output.

Replace complex sed parsing with portable grep -oE to extract sha256
hashes directly. Use tail -n1 to get the 'got:' hash (second match)
since nix outputs 'specified:' hash first.

Ref: anomalyco#11530 (comment)
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

The only other PR found is #11530 ("ci: fix nix hash issue"), which is actually the issue that PR #11533 is meant to close (as stated in the description: "Closes #11530"). This is not a duplicate - #11530 is the issue being addressed by the current PR.

No duplicate PRs found

@rekram1-node
Copy link
Collaborator

wanna just add the token change onto this pr too:
https://github.com/anomalyco/opencode/pull/11530/changes

@rekram1-node
Copy link
Collaborator

I think it'll fix that push failure

@jerome-benoit
Copy link
Contributor Author

jerome-benoit commented Jan 31, 2026

I think it'll fix that push failure

@rekram1-node, @gigamonster256: that PR with #11530 and the nix packaging pipeline should work again for all platform.

@jerome-benoit
Copy link
Contributor Author

wanna just add the token change onto this pr too: https://github.com/anomalyco/opencode/pull/11530/changes

You want me to integrate your changes also in that PR?

@gigamonster256
Copy link
Contributor

I'm a little bit away from knowing why the darwin vs linux build hashes differ, looks like the linux build of the darwin node_modules is pulling in extra deps

Details ...

Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/which-typed-array: 1.1.20@@@1
Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/why-is-node-running: 2.3.0@@@1
Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/why-is-node-running: 3.2.2@@@1
Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/widest-line: 5.0.0@@@1
Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/workerd: 1.20251118.0@@@1
Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/wrangler: 4.50.0@@@1
Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/wrap-ansi: 7.0.0@@@1
Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/wrap-ansi: 8.1.0@@@1
Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/wrap-ansi: 9.0.2@@@1
Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/wrappy: 1.0.2@@@1
Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/ws: 7.5.10@@@1
...

@jerome-benoit
Copy link
Contributor Author

I'm a little bit away from knowing why the darwin vs linux build hashes differ, looks like the linux build of the darwin node_modules is pulling in extra deps

The PR explain it: bun install with cpu and os on Linux does not produce byte-identical output as on the native platform.

@gigamonster256
Copy link
Contributor

I understand that, but... why? for instance the linux based darwin node_modules installs sst-darwin-arm64 but the darwin based one doesnt. That seems wrong.

Details Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/sst: 3.17.23@@@1 Only in /nix/var/nix/builds/nix-44933-3678005781/build/tmp.BqqdABf3oP/sst-darwin-arm64: 3.17.23@@@1

@jerome-benoit
Copy link
Contributor Author

jerome-benoit commented Jan 31, 2026

I understand that, but... why? for instance the linux based darwin node_modules installs sst-darwin-arm64 but the darwin based one doesnt. That seems wrong.

The dependencies tree has leaves that depend on the platform: fs notification, etc.. And most package managers in the JS ecosystem does not handle it strictly and do performance trade-off at computing the "merged" tree of the really needed deps.

@rekram1-node rekram1-node merged commit 0961632 into anomalyco:dev Jan 31, 2026
13 checks passed
alexyaroshuk pushed a commit to alexyaroshuk/opencode that referenced this pull request Feb 1, 2026
athal7 pushed a commit to athal7/opencode that referenced this pull request Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants