function enforceArch() {
echo checking target arches
for x in $out/lib/*.so; do
echo checking $x
readelf -A $x | grep "@target@"
done
}
postInstallHooks+=(enforceArch)
{ stdenv, makeSetupHook }:
let
target = if builtins.trace "system is ${stdenv.system}" stdenv.system == "armv6l-linux" then "Tag_CPU_arch: v6" else
(if stdenv.system == "armv7l-linux" then "Tag_CPU_arch: v7" else "NOP");
in
if target == "NOP" then
makeSetupHook {} ./nop.sh
else
makeSetupHook { substitutions = { inherit target; NIX_DEBUG="1"; }; } ./enforce-arch.sh