diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index 9f6ea813663..0921557c90c 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -14,6 +14,12 @@ let selfTargetTarget = pkgsTargetTarget.darwin or {}; # might be missing }; + # Prefix for binaries. Customarily ends with a dash separator. + # + # TODO(@Ericson2314) Make unconditional, or optional but always true by + # default. + targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) + (stdenv.targetPlatform.config + "-"); in lib.makeScopeWithSplicing splicePackages newScope otherSplices (_: {}) (spliced: spliced.apple_sdk.frameworks) (self: let @@ -104,6 +110,16 @@ impure-cmds // appleSourcePackages // chooseLibs // { sigtool = callPackage ../os-specific/darwin/sigtool { }; + postLinkSignHook = pkgs.writeTextFile { + name = "post-link-sign-hook"; + executable = true; + + text = '' + CODESIGN_ALLOCATE=${targetPrefix}codesign_allocate \ + ${self.sigtool}/bin/codesign -f -s - "$linkerOutput" + ''; + }; + maloader = callPackage ../os-specific/darwin/maloader { };