diff --git a/pkgs/by-name/ld/ldc/bootstrap.nix b/pkgs/by-name/ld/ldc/bootstrap.nix index fcb1f5191de9..3c6f528a5386 100644 --- a/pkgs/by-name/ld/ldc/bootstrap.nix +++ b/pkgs/by-name/ld/ldc/bootstrap.nix @@ -14,13 +14,17 @@ let OS = if hostPlatform.isDarwin then "osx" else hostPlatform.parsed.kernel.name; ARCH = if hostPlatform.isDarwin && hostPlatform.isAarch64 then "arm64" else hostPlatform.parsed.cpu.name; - version = "1.30.0"; + # Work around macOS Sequoia 15.4 segfault by downgrading the bootstrap compiler - see: + # - https://github.com/NixOS/nixpkgs/issues/398443 + # - https://github.com/dlang/dmd/issues/21126#issuecomment-2775948553 + # TODO: Remove this when bootstrap can be upgraded to a fixed version (>= 1.41.0-beta2)? + version = if hostPlatform.isDarwin then "1.28.1" else "1.30.0"; hashes = { # Get these from `nix store prefetch-file https://github.com/ldc-developers/ldc/releases/download/v1.19.0/ldc2-1.19.0-osx-x86_64.tar.xz` etc.. - osx-x86_64 = "sha256-AAWZvxuZC82xvrW6fpYm783TY+H8k3DvqE94ZF1yjmk="; + osx-x86_64 = "sha256-mqQ+hNlDePOGX2mwgEEzHGiOAx3SxfNA6x8+ML3qYmw="; linux-x86_64 = "sha256-V4TUzEfQhFrwiX07dHOgjdAoGkzausCkhnQIQNAU/eE="; linux-aarch64 = "sha256-kTeglub75iv/jWWNPCn15aCGAbmck0RQl6L7bFOUu7Y="; - osx-arm64 = "sha256-Nb/owBdIeroB9jLMDvwjo8bvsTC9vFyJPLMTOMsSAd4="; + osx-arm64 = "sha256-m93rGywncBnPEWslcrXuGBnZ+Z/mNgLIaevkL/uBOu0="; }; in stdenv.mkDerivation { diff --git a/pkgs/by-name/ld/ldc/package.nix b/pkgs/by-name/ld/ldc/package.nix index 95b6ffa898a0..c3c2ae795371 100644 --- a/pkgs/by-name/ld/ldc/package.nix +++ b/pkgs/by-name/ld/ldc/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchFromGitHub, + fetchpatch, callPackage, makeWrapper, removeReferencesTo, @@ -45,6 +46,17 @@ stdenv.mkDerivation (finalAttrs: { # https://issues.dlang.org/show_bug.cgi?id=19553 hardeningDisable = [ "fortify" ]; + # Fix output programs segfaulting on macOS Sequoia 15.4 - see: + # https://github.com/NixOS/nixpkgs/issues/398443 + # https://github.com/ldc-developers/ldc/issues/4899 + # TODO: Remove this when upgrading to a fixed version (>= 1.41.0-beta2) + patches = [ + (fetchpatch { + url = "https://github.com/ldc-developers/ldc/commit/60079c3b596053b1a70f9f2e0cf38a287089df56.patch"; + hash = "sha256-Y/5+zt5ou9rzU7rLJq2OqUxMDvC7aSFS6AsPeDxNATQ="; + }) + ]; + postPatch = '' patchShebangs runtime tools tests