llvmPackages_latest: move to aliases.nix

Because llvmPackages_latest is used in Nixpkgs, by quite a few
packages, it's difficult to keep it up to date, because updating it
requires some level of confidence that every package that uses it is
going to keep working after the update.  The result of this is that
llvmPackages_latest is not updated, and so we end up in the situation
that "latest" is two versions older than the latest version we
actually provide.  This is confusing and unexpected.

"But won't this end up fragmenting our LLVM versions, if every package
previously using _latest is separately pinned to LLVM 14?", I hear you
ask.  No.  That fragmentation is already happening, even with an
llvmPackages_latest, because packages that actually require the
_latest_ version of LLVM (15/16), have already been decoupled from
llvmPackages_latest since it hasn't been upgraded.  So like it or not,
we can't escape packages depending on specific recent LLVMs.  The only
real fix is to get better at keeping the default LLVM up to
date (which I'm reasonably confident we're getting into a better
position to be feasibly better able to do).

So, unless we want to double down on providing a confusingly named
"llvmPackages_latest" attribute that refers to some arbitrary LLVM
version that's probably not the latest one (or even the latest one
available in Nixpkgs), we only have two options here: either we don't
provide such an attribute at all, or we don't use it in Nixpkgs so we
don't become scared to bump it as soon as we have a new LLVM available.
This commit is contained in:
Alyssa Ross 2023-05-04 08:39:50 +00:00
parent 10faf3335e
commit ecc1ec2c72
6 changed files with 17 additions and 25 deletions

View file

@ -30,7 +30,7 @@ let
systemPlatform = platformMap.${pkgs.stdenv.hostPlatform.system} or (throw "scudo not supported on ${pkgs.stdenv.hostPlatform.system}");
in {
libPath = "${pkgs.llvmPackages_latest.compiler-rt}/lib/linux/libclang_rt.scudo-${systemPlatform}.so";
libPath = "${pkgs.llvmPackages_14.compiler-rt}/lib/linux/libclang_rt.scudo-${systemPlatform}.so";
description = ''
A user-mode allocator based on LLVM Sanitizers CombinedAllocator,
which aims at providing additional mitigations against heap based

View file

@ -4,7 +4,7 @@ let
# Well, we _can_ cross-compile from Linux :)
hello = pkgs.runCommand "hello" {
sdk = "${pkgs.darling.sdk}/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk";
nativeBuildInputs = with pkgs.llvmPackages_latest; [ clang-unwrapped lld ];
nativeBuildInputs = with pkgs.llvmPackages_14; [ clang-unwrapped lld ];
src = pkgs.writeText "hello.c" ''
#include <stdio.h>
int main() {

View file

@ -23,7 +23,6 @@
# for clang stdenv check
, foot
, llvmPackages
, llvmPackages_latest
}:
let
@ -187,10 +186,6 @@ stdenv.mkDerivation rec {
inherit (llvmPackages) stdenv;
};
clang-latest-compilation = foot.override {
inherit (llvmPackages_latest) stdenv;
};
noPgo = foot.override {
allowPgo = false;
};

View file

@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
./conf-symlink.patch
# This patch solves a duplicate symbol error when building with a clang stdenv
# Before removing this patch, please ensure the package still builds by running eg.
# nix-build -E 'with import ./. {}; pkgs.keyutils.override { stdenv = pkgs.llvmPackages_latest.stdenv; }'
# nix-build -E 'with import ./. {}; pkgs.keyutils.override { stdenv = pkgs.clangStdenv; }'
./0001-Remove-unused-function-after_eq.patch
# Fix build for s390-linux, where size_t is different from ptrdiff_t.

View file

@ -1886,6 +1886,7 @@ mapAliases ({
inherit (stdenv) buildPlatform hostPlatform targetPlatform; # Added 2023-01-09
# LLVM packages for (integration) testing that should not be used inside Nixpkgs:
llvmPackages_latest = llvmPackages_14;
llvmPackages_git = recurseIntoAttrs (callPackage ../development/compilers/llvm/git {
inherit (stdenvAdapters) overrideCC;
buildLlvmTools = buildPackages.llvmPackages_git.tools;

View file

@ -14505,7 +14505,7 @@ with pkgs;
ciao = callPackage ../development/compilers/ciao { };
codon = callPackage ../development/compilers/codon {
inherit (llvmPackages_latest) lld stdenv;
inherit (llvmPackages_14) lld stdenv;
};
colm = callPackage ../development/compilers/colm { };
@ -14568,7 +14568,7 @@ with pkgs;
clang_16 = llvmPackages_16.clang;
clang-tools = callPackage ../development/tools/clang-tools {
llvmPackages = llvmPackages_latest;
llvmPackages = llvmPackages_14;
};
clang-tools_5 = callPackage ../development/tools/clang-tools {
@ -14620,13 +14620,13 @@ with pkgs;
};
clang-analyzer = callPackage ../development/tools/analysis/clang-analyzer {
llvmPackages = llvmPackages_latest;
inherit (llvmPackages_latest) clang;
llvmPackages = llvmPackages_14;
inherit (llvmPackages_14) clang;
};
clazy = callPackage ../development/tools/analysis/clazy {
llvmPackages = llvmPackages_latest;
stdenv = llvmPackages_latest.stdenv;
llvmPackages = llvmPackages_14;
stdenv = llvmPackages_14.stdenv;
};
#Use this instead of stdenv to build with clang
@ -15580,7 +15580,7 @@ with pkgs;
lld_15 = llvmPackages_15.lld;
lld_16 = llvmPackages_16.lld;
lldb = llvmPackages_latest.lldb;
lldb = lldb_14;
lldb_5 = llvmPackages_5.lldb;
lldb_6 = llvmPackages_6.lldb;
lldb_7 = llvmPackages_7.lldb;
@ -15612,8 +15612,6 @@ with pkgs;
llvm-manpages = llvmPackages.llvm-manpages;
llvmPackages = let
latest_version = lib.toInt
(lib.versions.major llvmPackages_latest.llvm.version);
# This returns the minimum supported version for the platform. The
# assumption is that or any later version is good.
choose = platform:
@ -15622,7 +15620,7 @@ with pkgs;
else if platform.isAndroid then 12
else if platform.isLinux then 11
else if platform.isWasm then 12
else latest_version;
else 14;
# 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.
@ -15714,8 +15712,6 @@ with pkgs;
targetLlvm = targetPackages.llvmPackages_16.llvm or llvmPackages_16.llvm;
}));
llvmPackages_latest = llvmPackages_14;
llvmPackages_rocm = recurseIntoAttrs (callPackage ../development/compilers/llvm/rocm { });
lorri = callPackage ../tools/misc/lorri {
@ -17354,7 +17350,7 @@ with pkgs;
protege-distribution = callPackage ../development/web/protege-distribution { };
umr = callPackage ../development/misc/umr {
llvmPackages = llvmPackages_latest;
llvmPackages = llvmPackages_14;
};
refurb = callPackage ../development/tools/refurb { };
@ -17437,7 +17433,7 @@ with pkgs;
buf-language-server = callPackage ../development/tools/language-servers/buf-language-server { };
ccls = callPackage ../development/tools/language-servers/ccls {
llvmPackages = llvmPackages_latest;
llvmPackages = llvmPackages_14;
};
docker-compose-language-service = callPackage ../development/tools/language-servers/docker-compose-language-service { };
@ -17998,7 +17994,7 @@ with pkgs;
cvise = python3Packages.callPackage ../development/tools/misc/cvise {
# cvise keeps up with fresh llvm releases and supports wide version range
inherit (llvmPackages_latest) llvm libclang;
inherit (llvmPackages_14) llvm libclang;
};
cwltool = callPackage ../applications/science/misc/cwltool { };
@ -21384,7 +21380,7 @@ with pkgs;
libcint = callPackage ../development/libraries/libcint { };
libclc = callPackage ../development/libraries/libclc {
llvmPackages = llvmPackages_latest;
llvmPackages = llvmPackages_14;
};
libcli = callPackage ../development/libraries/libcli { };
@ -22419,7 +22415,7 @@ with pkgs;
libunwind =
if stdenv.isDarwin then darwin.libunwind
else if stdenv.hostPlatform.system == "riscv32-linux" then llvmPackages_latest.libunwind
else if stdenv.hostPlatform.system == "riscv32-linux" then llvmPackages_14.libunwind
else callPackage ../development/libraries/libunwind { };
libuv = callPackage ../development/libraries/libuv {