From 8dd78e6dc9fd8b2aabec9e4b016d44e118209503 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 4 Jan 2024 18:57:10 -0500 Subject: [PATCH] nix: fix installCheckPhase crashes on Darwin Ensure that `OBJC_DISABLE_INITIALIZE_FORK_SAFETY=yes` is set when starting the Nix daemon during tests, or the fetchurl.sh test will crash trying to initialize libcurl. This is happening since IPv6 support was enabled in https://github.com/NixOS/nixpkgs/pull/277471. See also: - http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html - https://github.com/NixOS/nix/pull/2674 --- pkgs/tools/package-management/nix/common.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/tools/package-management/nix/common.nix b/pkgs/tools/package-management/nix/common.nix index 0ea47dd7e17cf..7aa7b1cc1a1da 100644 --- a/pkgs/tools/package-management/nix/common.nix +++ b/pkgs/tools/package-management/nix/common.nix @@ -213,6 +213,11 @@ self = stdenv.mkDerivation { preInstallCheck = lib.optionalString stdenv.isDarwin '' export TMPDIR=$NIX_BUILD_TOP '' + # Prevent crashes in libcurl due to invoking Objective-C `+initialize` methods after `fork`. + # See http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html. + + lib.optionalString stdenv.isDarwin '' + export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=yes + '' # See https://github.com/NixOS/nix/issues/5687 + lib.optionalString (atLeast25 && stdenv.isDarwin) '' echo "exit 99" > tests/gc-non-blocking.sh