Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions nix/lib/patches.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,56 @@
};
}
)
# atf 0.23's configure.ac uses AC_RUN_IFELSE for three probes that
# cannot execute a compiled test binary during cross-compilation,
# aborting with:
# "configure: error: cannot run test program while cross compiling"
#
# This breaks the aarch64-apple-darwin cross-build chain:
# atf → libiconv → apple-sdk-14.4 → bindings-node-js-napi-*
# See https://github.com/xmtp/libxmtp/issues/3470
# and https://github.com/xmtp/libxmtp/issues/3476.
#
# Upstreamed as https://github.com/NixOS/nixpkgs/pull/510292 (merged,
# present in the current pin) — but the upstream seeds are gated on
# `!buildPlatform.canExecute hostPlatform`, and our nightly 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 and aborts
# (broke the 2026-07-03 nightly after #3810 dropped this overlay).
# Keep this structurally-gated copy until the upstream gate is
# `buildPlatform != hostPlatform`; double-applying the seeds when
# both gates fire is harmless (same cache values).
#
# The three AC_RUN_IFELSE cache variables and their justifications:
#
# kyua_cv_getopt_plus (m4/module-application.m4)
# Tests whether getopt(3) accepts a leading '+' for POSIX
# behavior. All target platforms (Darwin, glibc, musl) honour '+'.
#
# kyua_cv_attribute_noreturn (m4/module-defs.m4)
# Tests whether __attribute__((__noreturn__)) is supported by
# checking GCC version >= 2.5. All modern GCC/Clang satisfy this.
#
# kyua_cv_getcwd_works (m4/module-fs.m4)
# Tests whether getcwd(NULL, 0) dynamically allocates. Both
# Darwin and Linux (glibc and musl) support this.
#
# Pre-seeding all three is safe for every target in this flake.
# Gated on cross-compilation so native builds keep pulling from
# cache.nixos.org unchanged.
(
final: prev:
prev.lib.optionalAttrs (prev.stdenv.buildPlatform != prev.stdenv.hostPlatform) {
atf = prev.atf.overrideAttrs (old: {
configureFlags = (old.configureFlags or [ ]) ++ [
"kyua_cv_getopt_plus=yes"
"kyua_cv_attribute_noreturn=yes"
"kyua_cv_getcwd_works=yes"
];
});
}
)
# tcl 8.6.16 (pinned via nixpkgs 09061f74...) has multiple
# cross-compile bugs when targeting *-unknown-linux-musl, and the
# Hydra build farm only caches the x86_64-linux build host (not
Expand Down
Loading