From bfd9a7784eb4aeb7b02289d645ede4cd225183a3 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Thu, 19 Nov 2020 17:22:54 +0900 Subject: [PATCH] darwin.postLinkSignHook: init --- pkgs/top-level/darwin-packages.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 { };