From c4a5576f7bdd10916321d8d580881368f7fe9f85 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Mon, 1 Sep 2025 19:23:56 +0200 Subject: [PATCH] haskellPackages.llvm-ffi: always use default LLVM version The previous approach of selecting the highest possible LLVM version brought complications, especially when the latest LLVM release candidate was properly released and the llvm-ffi version on master didn't support this properly, yet. This would result in an eval failure that was impossible to properly solve on master. We only introduced the logic of selecting the latest LLVM version, because we didn't know about the cabal flags supporting lower LLVM versions at first. We then stuck with this approach. However, we can also just always use the default LLVM version that is present in `llvmPackages`. This is more in the spirit of a *default* version anyway. This will not result in any eval failures / warnings. There is only one failure mode: `haskellPackages.llvm-ffi` not supporting the new default LLVM version. In this case it's perfectly fine to wait for an update of llvm-ffi via `haskell-updates`. --- .../haskell-modules/configuration-nix.nix | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index 86844adf8d90..b52629711680 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -507,24 +507,21 @@ builtins.intersectAttrs super { # LLVM input that llvm-ffi declares. llvm-ffi = let - chosenLlvmVersion = 20; - nextLlvmAttr = "llvmPackages_${toString (chosenLlvmVersion + 1)}"; - shouldUpgrade = - pkgs ? ${nextLlvmAttr} && (lib.strings.match ".+rc.+" pkgs.${nextLlvmAttr}.llvm.version) == null; + currentDefaultVersion = lib.versions.major pkgs.llvmPackages.llvm.version; + latestSupportedVersion = lib.versions.major super.llvm-ffi.version; in - lib.warnIf shouldUpgrade - "haskellPackages.llvm-ffi: ${nextLlvmAttr} is available in Nixpkgs, consider updating." - lib.pipe - super.llvm-ffi + lib.pipe super.llvm-ffi ( [ - # ATTN: There is no matching flag for the latest supported LLVM version, - # so you may need to remove this when updating chosenLlvmVersion - (enableCabalFlag "LLVM${toString chosenLlvmVersion}00") (addBuildDepends [ - pkgs."llvmPackages_${toString chosenLlvmVersion}".llvm.lib - pkgs."llvmPackages_${toString chosenLlvmVersion}".llvm.dev + pkgs.llvmPackages.llvm.lib + pkgs.llvmPackages.llvm.dev ]) - ]; + ] + # There is no matching flag for the latest supported LLVM version. + ++ lib.optional (currentDefaultVersion != latestSupportedVersion) ( + enableCabalFlag "LLVM${currentDefaultVersion}00" + ) + ); # Needs help finding LLVM. spaceprobe = addBuildTool self.buildHaskellPackages.llvmPackages.llvm super.spaceprobe;