summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-05-13 05:24:55 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-05-14 19:12:22 +0000
commite3a1c149d26bd82c4b42ba5e06fec73933ce8bf6 (patch)
tree39758e1bff7d383cd8e1dd50803ef1fe2a242017
parentf030f859b95624c81f72d07a55fbfa88e4456790 (diff)
downloadnixpkgs-e3a1c149d26bd82c4b42ba5e06fec73933ce8bf6.tar
nixpkgs-e3a1c149d26bd82c4b42ba5e06fec73933ce8bf6.tar.gz
nixpkgs-e3a1c149d26bd82c4b42ba5e06fec73933ce8bf6.tar.bz2
nixpkgs-e3a1c149d26bd82c4b42ba5e06fec73933ce8bf6.tar.lz
nixpkgs-e3a1c149d26bd82c4b42ba5e06fec73933ce8bf6.tar.xz
nixpkgs-e3a1c149d26bd82c4b42ba5e06fec73933ce8bf6.tar.zst
nixpkgs-e3a1c149d26bd82c4b42ba5e06fec73933ce8bf6.zip
llvmPackages: Fix default version calculation
Add a comment with explanation, which I should have done all along.
-rw-r--r--pkgs/top-level/all-packages.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index b3e669bab95..3fd6a307b43 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 {