Skip to content

Instantly share code, notes, and snippets.

@cleverca22
Created December 15, 2016 20:07
Show Gist options
  • Save cleverca22/333cc892ee345c8ccd3b98ff73abfa52 to your computer and use it in GitHub Desktop.
Save cleverca22/333cc892ee345c8ccd3b98ff73abfa52 to your computer and use it in GitHub Desktop.
{ 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
function enforceArch() {
echo checking target arches
for x in $out/lib/*.so; do
echo checking $x
readelf -A $x | grep "@target@"
done
}
postInstallHooks+=(enforceArch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment