Skip to content

nix: restore atf cross overlay dropped in #3810 - #3822

Merged
insipx merged 1 commit into
mainfrom
insipx/restore-atf-cross-overlay
Jul 6, 2026
Merged

nix: restore atf cross overlay dropped in #3810#3822
insipx merged 1 commit into
mainfrom
insipx/restore-atf-cross-overlay

Conversation

@insipx

@insipx insipx commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

The 2026-07-03 nightly failed in release-node-sdk / bindings / build-macos (darwin-arm64):

atf-aarch64-apple-darwin> configure: error: cannot run test program while cross compiling
error: Cannot build '...libiconv-aarch64-apple-darwin-113.drv' — 1 dependency failed
error: Cannot build '...bindings-node-js-napi-aarch64-apple-darwin-1.11.0-dev.drv'

No node-sdk/node-bindings npm nightly has published since 20260630.ac662b3 — and because the nightly watermark is the latest tag of any SDK, the successful iOS leg's 20260703 tag makes every subsequent scheduled run log "No new commits since last nightly; skipping", so the node leg never retried.

Why the upstream fix doesn't cover this

#3810 removed this overlay expecting NixOS/nixpkgs#510292 (merged, present in the pinned nixos-unstable rev b5aa0fbd) to cover it. The upstream seeds are gated on !stdenv.buildPlatform.canExecute stdenv.hostPlatform — but this build's cross is aarch64-darwin → aarch64-apple-darwin: same arch, same kernel, so canExecute is true and the seeds never apply, while autoconf still decides cross_compiling=yes from the configured-triple mismatch and aborts the AC_RUN_IFELSE probes.

This restores the original overlay verbatim (structurally gated on buildPlatform != hostPlatform) with the comment updated to record the upstream state and the retirement condition: the upstream gate switching to structural inequality (nixpkgs follow-up incoming). Double-applying the seeds when both gates fire is harmless — same cache values.

Verification: nix-instantiate --parse clean; the real proof is the next scheduled nightly (new commit un-skips the watermark) or a manual Release dispatch with node-sdk: true.

🤖 Generated with Claude Code

Note

Restore atf cross-compilation overlay in nix patches

Restores an overlay in patches.nix that was dropped in #3810. When buildPlatform != hostPlatform, the atf derivation is overridden to pre-seed three autoconf cache variables (kyua_cv_getopt_plus, kyua_cv_attribute_noreturn, kyua_cv_getcwd_works) so AC_RUN_IFELSE tests are skipped and configuration succeeds during cross-compilation.

Macroscope summarized f4005df.

The 2026-07-03 nightly failed in release-node-sdk/bindings/build-macos
(darwin-arm64): atf-aarch64-apple-darwin aborts with "cannot run test
program while cross compiling", cascading through libiconv →
apple-sdk-14.4 → bindings-node-js-napi. No node/bindings npm nightly
has published since 20260630 (and the shared last-nightly watermark
from the iOS tag keeps subsequent runs skipping).

The overlay was removed in #3810 on the expectation that
NixOS/nixpkgs#510292 (merged, present in the pinned nixos-unstable rev)
covers it. It does not for this build: the upstream seeds are gated on
!buildPlatform.canExecute hostPlatform, and our cross is
aarch64-darwin → aarch64-apple-darwin — same arch and kernel, so
canExecute is true and the seeds never apply, while autoconf still
decides cross_compiling=yes from the triple mismatch. Restore the
structurally-gated (buildPlatform != hostPlatform) overlay until the
upstream gate matches; double-applying the seeds is harmless.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@insipx
insipx requested a review from a team as a code owner July 6, 2026 16:02
@claude

claude Bot commented Jul 6, 2026

Copy link
Copy Markdown

Claude finished @insipx's task —— View job


Code Review — 2026-07-06 16:03 UTC

Summary

The implementation is correct and well-justified. This is a pragmatic workaround for a gap in the upstream nixpkgs fix where structural cross-compilation detection (buildPlatform != hostPlatform) differs from runtime capability detection (canExecute).

Positive Observations

  1. Excellent documentation (lines 11-46): The comment thoroughly explains:

    • The root cause (AC_RUN_IFELSE probes in atf 0.23)
    • Why the upstream fix doesn't apply (canExecute gate mismatch)
    • Justification for each cache variable with platform research
    • Retirement condition (upstream switching to structural inequality)
  2. Correct gate condition (line 51): Using buildPlatform != hostPlatform is the appropriate structural check that catches the aarch64-darwin → aarch64-apple-darwin case.

  3. Safe implementation:

    • Properly preserves existing configureFlags with old.configureFlags or []
    • Cache variable seeding is idempotent (double-application is harmless as noted)
    • Gated to cross-builds only (preserves cache.nixos.org substitution for native)
  4. Low risk: The three cache variables are conservatively seeded based on well-researched platform behavior that holds across Darwin, glibc, and musl.

No Issues Found

  • Code quality: ✓ Idiomatic Nix, follows patterns from other overlays in the file
  • Bugs: None identified
  • Performance: ✓ Conditional application minimizes impact
  • Security: ✓ No security implications (configuration flags only)
  • Test coverage: Manual verification via nightly builds is appropriate for Nix overlays

Recommendation

Approve. This is a necessary bridge until nixpkgs switches to structural inequality. The implementation is sound and well-documented.


Tasks Completed

  • Read changed file nix/lib/patches.nix
  • Analyze the overlay implementation
  • Review code quality and best practices
  • Check for potential bugs or issues
  • Post review feedback

@macroscopeapp

macroscopeapp Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Restores a Nix cross-compilation overlay for the atf package that was accidentally dropped in #3810. This is a build configuration fix with no runtime impact, well-documented rationale, and the author owns the affected file.

You can customize Macroscope's approvability policy. Learn more.

@insipx
insipx enabled auto-merge (squash) July 6, 2026 16:10
@insipx
insipx merged commit a338198 into main Jul 6, 2026
41 of 42 checks passed
@insipx
insipx deleted the insipx/restore-atf-cross-overlay branch July 6, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant