diff --git a/nix/pyenv.nix b/nix/pyenv.nix index 26735b406..9923978b7 100644 --- a/nix/pyenv.nix +++ b/nix/pyenv.nix @@ -198,6 +198,7 @@ let cctools, stdenv, fetchFromGitHub, + fetchpatch, }: prev.unicorn.overrideAttrs ( old: @@ -214,17 +215,22 @@ let postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' substituteInPlace ./src/CMakeLists.txt \ - --replace-fail 'set(CMAKE_C_COMPILER "/usr/bin/cc")' 'set(CMAKE_C_COMPILER "${stdenv.cc}/bin/cc")' || true - - # Due to an issue with the Apple ARM64 Hypervisor on GitHub Actions, - # we need to force the `sprr` register check. - # Otherwise, Nix may cache broken builds. - # See: - # - https://github.com/actions/runner-images/issues/11127 - # - https://github.com/unicorn-engine/unicorn/issues/2033 - substituteInPlace ./src/qemu/configure \ - --replace-fail "have_sprr_mrs='no'" "have_sprr_mrs='yes'" + --replace-fail 'set(CMAKE_C_COMPILER "/usr/bin/cc")' 'set(CMAKE_C_COMPILER "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc")' ''; + + # Remove this block after upgrading to unicorn 2.2.0 + patches = lib.optionals stdenv.hostPlatform.isDarwin [ + (fetchpatch { + url = "https://github.com/unicorn-engine/unicorn/commit/79f910ea73220f4f603b6050593af86483573908.patch"; + hash = "sha256-AIMetsuYx1wz2KNtHcsyBfue+dBIDMVdqIiPaQ3xfgs="; + includes = [ + "src/qemu/configure" + "src/qemu/include/tcg/tcg-apple-jit.h" + ]; + stripLen = 1; + extraPrefix = "src/"; + }) + ]; } // lib.optionalAttrs stdenv.hostPlatform.isLoongArch64 { # Remove this block after upgrading to unicorn 2.2.0