From e3a1c149d26bd82c4b42ba5e06fec73933ce8bf6 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 13 May 2021 05:24:55 +0000 Subject: [PATCH] llvmPackages: Fix default version calculation Add a comment with explanation, which I should have done all along. --- pkgs/top-level/all-packages.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b3e669bab95f..3fd6a307b43e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11198,6 +11198,8 @@ in llvm_5 = llvmPackages_5.llvm; llvmPackages = let + # This returns the minimum suported version for the platform. The + # assumption is that or any later version is good. choose = platform: /**/ if platform.isDarwin then "7" else if platform.isFreeBSD then "7" @@ -11205,7 +11207,10 @@ in else if platform.isLinux then "7" else if platform.isWasm then "8" else "latest"; - minSupported = lib.min (choose stdenv.hostPlatform) (choose stdenv.targetPlatform); + # We take the "max of the mins". Why? Since those are lower bounds of the + # supported version set, this is like intersecting those sets and then + # taking the min bound of that. + minSupported = lib.max (choose stdenv.hostPlatform) (choose stdenv.targetPlatform); in pkgs.${"llvmPackages_${minSupported}"}; llvmPackages_5 = recurseIntoAttrs (callPackage ../development/compilers/llvm/5 {