Skip to content

Commit

Permalink
removeReferencesToVendoredSources: manually sign on aarch64-darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Zlender committed Oct 13, 2023
1 parent 25c0d96 commit 14d48cf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/setupHooks/removeReferencesToVendoredSources.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{ makeSetupHook
{ darwin
, lib
, makeSetupHook
, stdenv
}:

let
darwinCodeSign = stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64;
in
makeSetupHook
{
name = "removeReferencesToVendoredSourcesHook";
substitutions = {
storeDir = builtins.storeDir;
signingUtils = if darwinCodeSign then darwin.signingUtils else null;
};
} ./removeReferencesToVendoredSourcesHook.sh
12 changes: 11 additions & 1 deletion lib/setupHooks/removeReferencesToVendoredSourcesHook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,23 @@ removeReferencesToVendoredSources() {
echo -n '\)!@storeDir@/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee!g'
)

# Sign modified binaries on aarch64-darwin
if [ -n "${signingUtils}" ]; then
signIfRequired "${installedFile}"
fi
done < <(find "${installLocation}" -type f)
}

if [ -n "${doNotRemoveReferencesToVendorDir-}" ]; then
echo "removeReferencesToVendoredSources disabled"
elif [ -n "${cargoVendorDir-}" ]; then
fixupHooks+=(removeReferencesToVendoredSources)
signingUtils="@signingUtils@"
if [ -n "${signingUtils}" ]; then
source "${signingUtils}"
fi

postFixupHooks+=(removeReferencesToVendoredSources)
else
echo "cargoVendorDir not set, will not attempt to remove any references"
fi

0 comments on commit 14d48cf

Please sign in to comment.