summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorRandy Eckenrode <randy@largeandhighquality.com>2023-05-19 15:49:09 -0400
committerRandy Eckenrode <randy@largeandhighquality.com>2023-05-29 15:43:58 -0400
commit0d3355a439f2100f232e0319a0cb393134dbbdbe (patch)
tree9913b3bae8757e02aa6e595b79256d4327d0d1e6 /pkgs
parent5611fa71ab437f0be9fda35cdeb47df6fdc40659 (diff)
downloadnixpkgs-0d3355a439f2100f232e0319a0cb393134dbbdbe.tar
nixpkgs-0d3355a439f2100f232e0319a0cb393134dbbdbe.tar.gz
nixpkgs-0d3355a439f2100f232e0319a0cb393134dbbdbe.tar.bz2
nixpkgs-0d3355a439f2100f232e0319a0cb393134dbbdbe.tar.lz
nixpkgs-0d3355a439f2100f232e0319a0cb393134dbbdbe.tar.xz
nixpkgs-0d3355a439f2100f232e0319a0cb393134dbbdbe.tar.zst
nixpkgs-0d3355a439f2100f232e0319a0cb393134dbbdbe.zip
swift-corelibs: set NIX_COREFOUNDATION_RPATH in a hook
Closes #230870. Thanks to @eliasnaur for the test case and for rasining
awareness and to @veprbl for the work done on #111385.

This takes a slightly different approach from those two PRs. The hook is
set unconditionally. The stdenv bootstrap doesn’t really need CF at all,
so setting the hook is harmless. This simplifies things.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix4
-rw-r--r--pkgs/os-specific/darwin/swift-corelibs/pure-corefoundation-hook.sh7
2 files changed, 10 insertions, 1 deletions
diff --git a/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix b/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix
index 7c48d695e11..1e7aeb3689e 100644
--- a/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix
+++ b/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub, fetchurl, ninja, python3, curl, libxml2, objc4, ICU }:
+{ lib, stdenv, fetchFromGitHub, fetchurl, makeSetupHook, ninja, python3, curl, libxml2, objc4, ICU }:
 
 let
   # 10.12 adds a new sysdir.h that our version of CF in the main derivation depends on, but
@@ -104,4 +104,6 @@ stdenv.mkDerivation {
       ln -s Versions/Current/$i $base/$i
     done
   '';
+
+    darwinEnvHook = makeSetupHook { name = "darwin-env-hook"; } ./pure-corefoundation-hook.sh;
 }
diff --git a/pkgs/os-specific/darwin/swift-corelibs/pure-corefoundation-hook.sh b/pkgs/os-specific/darwin/swift-corelibs/pure-corefoundation-hook.sh
new file mode 100644
index 00000000000..d5539f50861
--- /dev/null
+++ b/pkgs/os-specific/darwin/swift-corelibs/pure-corefoundation-hook.sh
@@ -0,0 +1,7 @@
+usePureCoreFoundation() {
+# Avoid overriding value set by the impure CF
+    if [ -z "${NIX_COREFOUNDATION_RPATH:-}" ]; then
+        export NIX_COREFOUNDATION_RPATH=@out@/Library/Frameworks
+    fi
+}
+addEnvHooks "$hostOffset" usePureCoreFoundation