From ddafd4b14a91dc510524247fd266f85cdb740d1a Mon Sep 17 00:00:00 2001 From: Peter Waller Date: Sat, 14 Sep 2024 15:37:31 +0100 Subject: [PATCH] llvmPackages: Reinstate overriding across whole package set Pull #320261 introduced the possibility to consistently override dependencies within an llvm package set. I think #325175 accidentally dropped this, so reinstate it. Signed-off-by: Peter Waller --- .../compilers/llvm/common/default.nix | 3 ++ pkgs/development/compilers/llvm/default.nix | 49 +++++++++++-------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index fe5b432f8cf0d..ddb22f0b92d29 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -26,6 +26,9 @@ officialRelease ? null, monorepoSrc ? null, version ? null, + # Allows passthrough to packages via newScope. This makes it possible to + # do `(llvmPackages.override { = bar; }).clang` and get + # an llvmPackages whose packages are overridden in an internally consistent way. ... }@args: diff --git a/pkgs/development/compilers/llvm/default.nix b/pkgs/development/compilers/llvm/default.nix index 490b90e2de049..5847fccfcc657 100644 --- a/pkgs/development/compilers/llvm/default.nix +++ b/pkgs/development/compilers/llvm/default.nix @@ -14,7 +14,12 @@ bootBintoolsNoLibc ? if stdenv.targetPlatform.linker == "lld" then null else pkgs.bintoolsNoLibc, bootBintools ? if stdenv.targetPlatform.linker == "lld" then null else pkgs.bintools, llvmVersions ? { }, -}: + # Allows passthrough to packages via newScope in ./common/default.nix. + # This makes it possible to do + # `(llvmPackages.override { = bar; }).clang` and get + # an llvmPackages whose packages are overridden in an internally consistent way. + ... +}@packageSetArgs: let versions = { "13.0.1".officialRelease.sha256 = "06dv6h5dmvzdxbif2s8njki6h32796v368dyb5945x8gjj72xh7k"; @@ -53,25 +58,29 @@ let in lib.nameValuePair attrName ( recurseIntoAttrs ( - callPackage ./common { - inherit (stdenvAdapters) overrideCC; - buildLlvmTools = buildPackages."llvmPackages_${attrName}".tools; - targetLlvmLibraries = - targetPackages."llvmPackages_${attrName}".libraries or llvmPackages."${attrName}".libraries; - targetLlvm = targetPackages."llvmPackages_${attrName}".llvm or llvmPackages."${attrName}".llvm; - stdenv = - if (lib.versions.major release_version == "13" && stdenv.cc.cc.isGNU or false) then - gcc12Stdenv - else - stdenv; # does not build with gcc13 - inherit bootBintoolsNoLibc bootBintools; - inherit - officialRelease - gitRelease - monorepoSrc - version - ; - } + callPackage ./common ( + { + inherit (stdenvAdapters) overrideCC; + buildLlvmTools = buildPackages."llvmPackages_${attrName}".tools; + targetLlvmLibraries = + targetPackages."llvmPackages_${attrName}".libraries or llvmPackages."${attrName}".libraries; + targetLlvm = targetPackages."llvmPackages_${attrName}".llvm or llvmPackages."${attrName}".llvm; + inherit + officialRelease + gitRelease + monorepoSrc + version + ; + } + // packageSetArgs # Allow overrides. + // { + stdenv = + if (lib.versions.major release_version == "13" && stdenv.cc.cc.isGNU or false) then + gcc12Stdenv + else + stdenv; # does not build with gcc13 + } + ) ) );