From 44a9c1412d540077611dc9be4ab12befc1ad1bc9 Mon Sep 17 00:00:00 2001 From: Etienne Robert Date: Fri, 29 May 2026 12:51:46 +0200 Subject: [PATCH] fix(aaron): workaround compiler-rt 18 darwin build via overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apple SDK 26.4 ships libc++ 21, which dropped the fallbacks for __builtin_ctzg/__builtin_clzg — builtins Clang 18 does not recognize. nixos-unstable has been stuck at 64c08a7 (2026-05-23) ever since, because Hydra cannot advance past this failure. Mirror NixOS/nixpkgs#523142 with a host-scoped overlay that disables the C++ components (XRAY, LIBFUZZER, MEMPROF, ORC) of compiler-rt 18. Built locally on aarch64-darwin; the overlay propagates through the stdenv-darwin bootstrap via overrideScope. Refs: NixOS/nixpkgs#480849, NixOS/nixpkgs#523142 --- modules/hosts/aaron/configuration.nix | 34 +++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/modules/hosts/aaron/configuration.nix b/modules/hosts/aaron/configuration.nix index 6a9ea4dc..9ceaa351 100644 --- a/modules/hosts/aaron/configuration.nix +++ b/modules/hosts/aaron/configuration.nix @@ -61,13 +61,33 @@ in networking.hostName = "aaron"; networking.computerName = "aaron"; - # Packages pinned to older nixpkgs until binary cache is available. - # Remove entries once the package has a cached build for aarch64-darwin. - # nixpkgs.overlays = [ - # (_final: _prev: { - # inherit (nixpkgs-darwin-pins.legacyPackages.aarch64-darwin) deno; - # }) - # ]; + # Workaround for NixOS/nixpkgs#480849: building llvmPackages_18.compiler-rt + # on Darwin fails because Apple SDK 26.4 ships libc++ 21, which dropped the + # fallbacks for __builtin_ctzg/__builtin_clzg — builtins that Clang 18 does + # not recognize. Mirror the fix from NixOS/nixpkgs#523142 by disabling the + # C++ components of compiler-rt 18 here. + # + # TODO: remove this overlay once nixos-unstable advances past the fix. + # Trigger: NixOS/nixpkgs#523142 (or its replacement) is merged AND lands in + # nixos-unstable. Verify by deleting the overlay block below and running + # `nix build .#darwinConfigurations.aaron.system` — if it succeeds, delete + # for good. If it still errors with `__builtin_ctzg`, keep the overlay. + nixpkgs.overlays = [ + (_final: prev: { + llvmPackages_18 = prev.llvmPackages_18.overrideScope ( + _llvmFinal: llvmPrev: { + compiler-rt-libc = llvmPrev.compiler-rt-libc.overrideAttrs (old: { + cmakeFlags = (old.cmakeFlags or [ ]) ++ [ + (lib.cmakeBool "COMPILER_RT_BUILD_XRAY" false) + (lib.cmakeBool "COMPILER_RT_BUILD_LIBFUZZER" false) + (lib.cmakeBool "COMPILER_RT_BUILD_MEMPROF" false) + (lib.cmakeBool "COMPILER_RT_BUILD_ORC" false) + ]; + }); + } + ); + }) + ]; system = { primaryUser = "soft";