diff --git a/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix b/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix index 7c48d695e11d1..1e7aeb3689ea9 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 0000000000000..d5539f50861a4 --- /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 diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 780717db56b88..64e33aa772e0b 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -683,7 +683,6 @@ rec { targetPlatform = localSystem; preHook = commonPreHook + '' - export NIX_COREFOUNDATION_RPATH=${pkgs.darwin.CF}/Library/Frameworks export PATH_LOCALE=${pkgs.darwin.locale}/share/locale '';