-
Notifications
You must be signed in to change notification settings - Fork 118
Description
We have some rust cdylibs that get linked into another application. On aarch64-darwin, these would crash at runtime due to a code signing verification failure.
Since the dylibs id (LC_ID_DYLIB) needs to match with their on-disk location, it's common to use the fixDarwinDylibNames build hook in order to update it to the nix store path, so it doesn't reference the cargo target folder. This takes place in the fixup phase, since the hook is added to fixupOutputHooks.
However, because removeReferencesToVendoredSources added a code signature in the postInstall phase, the LC_ID_DYLIB change invalidates the signature because it changes mach-o headers.
I would propose moving reference removal and code signing into the fixup phase, and conditionally adding fixDarwinDylibNames whenever the stdenv host platform is aarch64-darwin. This way the LC_ID_DYLIB fixup would always happen before code signing.
What do you think?