summary refs log tree commit diff
path: root/pkgs/os-specific/darwin/signing-utils/post-link-sign-hook.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/darwin/signing-utils/post-link-sign-hook.nix')
-rw-r--r--pkgs/os-specific/darwin/signing-utils/post-link-sign-hook.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/os-specific/darwin/signing-utils/post-link-sign-hook.nix b/pkgs/os-specific/darwin/signing-utils/post-link-sign-hook.nix
new file mode 100644
index 00000000000..13595e3771a
--- /dev/null
+++ b/pkgs/os-specific/darwin/signing-utils/post-link-sign-hook.nix
@@ -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
+  '';
+}