Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
31 lines
756 B
Nix
31 lines
756 B
Nix
{
|
|
stdenv,
|
|
runCommand,
|
|
makeBinaryWrapper,
|
|
binutils,
|
|
lib,
|
|
expectedArch ? stdenv.hostPlatform.parsed.cpu.name,
|
|
}:
|
|
|
|
runCommand "make-binary-wrapper-test-cross"
|
|
{
|
|
nativeBuildInputs = [
|
|
makeBinaryWrapper
|
|
binutils
|
|
];
|
|
# For x86_64-linux the machine field is
|
|
# Advanced Micro Devices X86-64
|
|
# and uses a dash instead of a underscore unlike x86_64-linux in hostPlatform.parsed.cpu.name
|
|
expectedArch = lib.replaceStrings [ "_" ] [ "-" ] expectedArch;
|
|
}
|
|
''
|
|
touch prog
|
|
chmod +x prog
|
|
makeWrapper prog $out
|
|
read -r _ arch < <($READELF --file-header $out | grep Machine:)
|
|
if [[ ''${arch,,} != *"''${expectedArch,,}"* ]]; then
|
|
echo "expected $expectedArch, got $arch"
|
|
exit 1
|
|
fi
|
|
''
|