Skip to content

Commit 5fbc24d

Browse files
committed
The binfmt check is for the machine that needs emulation, not for CI
`nix build .#apk` failed on the runner before doing any work, on a guard demanding `/proc/sys/fs/binfmt_misc/x86_64-linux`. That entry exists to let an ARM machine run Google's linux-x86_64 binaries — a native x86_64 builder has no binfmt entry for its own architecture and wants none, so the check failed the one platform the derivation actually targets. So it runs only where emulation is involved. The message is unchanged and still finds the ARM machine that has forgotten to register it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01295NxmwQWXFMajoxKhWbpB
1 parent 15d86e3 commit 5fbc24d

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

‎flake.nix‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -512,15 +512,21 @@
512512
export HOME=$TMPDIR
513513
export CARGO_HOME=$TMPDIR/cargo
514514
515-
if ! ${pkgs.coreutils}/bin/test -e /proc/sys/fs/binfmt_misc/x86_64-linux; then
516-
echo "" >&2
517-
echo "This needs to run x86_64 binaries: everything Google ships" >&2
518-
echo "for Android is linux-x86_64 only. On NixOS:" >&2
519-
echo "" >&2
520-
echo " boot.binfmt.emulatedSystems = [ \"x86_64-linux\" ];" >&2
521-
echo "" >&2
522-
exit 1
523-
fi
515+
# Only where emulation is actually involved. A native x86_64
516+
# builder has no `binfmt_misc` entry for its own architecture and
517+
# does not want one, so asking for it there fails a build that
518+
# would otherwise run — which is what CI hit.
519+
${pkgs.lib.optionalString (system != "x86_64-linux") ''
520+
if ! ${pkgs.coreutils}/bin/test -e /proc/sys/fs/binfmt_misc/x86_64-linux; then
521+
echo "" >&2
522+
echo "This needs to run x86_64 binaries: everything Google ships" >&2
523+
echo "for Android is linux-x86_64 only. On NixOS:" >&2
524+
echo "" >&2
525+
echo " boot.binfmt.emulatedSystems = [ \"x86_64-linux\" ];" >&2
526+
echo "" >&2
527+
exit 1
528+
fi
529+
''}
524530
525531
echo "--- the mutator module"
526532
./scripts/mutators.sh

0 commit comments

Comments
 (0)