Merge pull request #238323 from szlend/fixed-path-codesign-allocate

codesign_allocate: use absolute path
This commit is contained in:
Weijia Wang 2023-08-02 22:10:22 +02:00 committed by GitHub
commit 67633c2a6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 18 deletions

View File

@ -79,16 +79,11 @@ rec {
let
name = last (builtins.split "/" nameOrPath);
in
pkgs.runCommand name ((if (types.str.check content) then {
pkgs.runCommand name (if (types.str.check content) then {
inherit content;
passAsFile = [ "content" ];
} else {
contentPath = content;
}) // lib.optionalAttrs (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) {
# post-link-hook expects codesign_allocate to be in PATH
# https://github.com/NixOS/nixpkgs/issues/154203
# https://github.com/NixOS/nixpkgs/issues/148189
nativeBuildInputs = [ stdenv.cc.bintools ];
}) ''
${compileScript}
${lib.optionalString strip

View File

@ -0,0 +1,13 @@
{ writeTextFile, cctools, sigtool }:
writeTextFile {
name = "post-link-sign-hook";
executable = true;
text = ''
if [ "$linkerOutput" != "/dev/null" ]; then
CODESIGN_ALLOCATE=${cctools}/bin/${cctools.targetPrefix}codesign_allocate \
${sigtool}/bin/codesign -f -s - "$linkerOutput"
fi
'';
}

View File

@ -464,6 +464,10 @@ in
inherit (selfDarwin) sigtool;
};
postLinkSignHook = prevStage.darwin.postLinkSignHook.override {
inherit (selfDarwin) sigtool;
};
binutils = superDarwin.binutils.override {
inherit (self) coreutils;
inherit (selfDarwin) postLinkSignHook signingUtils;

View File

@ -133,20 +133,10 @@ impure-cmds // appleSourcePackages // chooseLibs // {
sigtool = callPackage ../os-specific/darwin/sigtool { };
postLinkSignHook = pkgs.writeTextFile {
name = "post-link-sign-hook";
executable = true;
text = ''
if [ "$linkerOutput" != "/dev/null" ]; then
CODESIGN_ALLOCATE=${targetPrefix}codesign_allocate \
${self.sigtool}/bin/codesign -f -s - "$linkerOutput"
fi
'';
};
signingUtils = callPackage ../os-specific/darwin/signing-utils { };
postLinkSignHook = callPackage ../os-specific/darwin/signing-utils/post-link-sign-hook.nix { };
autoSignDarwinBinariesHook = pkgs.makeSetupHook {
name = "auto-sign-darwin-binaries-hook";
propagatedBuildInputs = [ self.signingUtils ];