darwin: wrap strip and install_name_tool to codesign modified files

Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
This commit is contained in:
Andrew Childs
2021-05-17 00:27:02 +09:00
co-authored by Moritz Angermann
parent 7eb1e3695d
commit 772b66531a
4 changed files with 149 additions and 0 deletions
@@ -14,6 +14,9 @@
, extraPackages ? [], extraBuildCommands ? ""
, buildPackages ? {}
, useMacosReexportHack ? false
# Darwin code signing support utilities
, postLinkSignHook ? null, signingUtils ? null
}:
with lib;
@@ -339,6 +342,24 @@ stdenv.mkDerivation {
''
)
##
## Code signing on Apple Silicon
##
+ optionalString (targetPlatform.isDarwin && targetPlatform.isAarch64) ''
echo 'source ${postLinkSignHook}' >> $out/nix-support/post-link-hook
export signingUtils=${signingUtils}
wrap \
${targetPrefix}install_name_tool \
${./darwin-install_name_tool-wrapper.sh} \
"${bintools_bin}/bin/${targetPrefix}install_name_tool"
wrap \
${targetPrefix}strip ${./darwin-strip-wrapper.sh} \
"${bintools_bin}/bin/${targetPrefix}strip"
''
##
## Extra custom steps
##