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";