Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions pkgs/build-support/writers/scripts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions pkgs/os-specific/darwin/signing-utils/post-link-sign-hook.nix
Original file line number Diff line number Diff line change
@@ -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
'';
}
4 changes: 4 additions & 0 deletions pkgs/stdenv/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 2 additions & 12 deletions pkgs/top-level/darwin-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand Down