Skip to content

Commit

Permalink
nix: fix installCheckPhase crashes on Darwin
Browse files Browse the repository at this point in the history
With NixOS#277471 merged, nix crashes during `installCheckPhase` because
libcurl tries to call `SCDynamicStoreCopyProxies` when IPv6 is enabled.
This triggers a crash due to invoking an Objective-C `+initialize`
method after `fork` is called.

See http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html.

See also NixOS/nix#2674, which addresses the issue in nix-daemon.
  • Loading branch information
reckenrode committed Jan 5, 2024
1 parent 434f6ae commit 813857a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkgs/tools/package-management/nix/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ self = stdenv.mkDerivation {
preInstallCheck = lib.optionalString stdenv.isDarwin ''
export TMPDIR=$NIX_BUILD_TOP
''
# Prevent crashes in libcurl due to invoking Objective-C `initialize` after `fork`.
+ 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
Expand Down

0 comments on commit 813857a

Please sign in to comment.