Skip to content

Commit

Permalink
llvmPackages: Reinstate overriding across whole package set
Browse files Browse the repository at this point in the history
Pull NixOS#320261 introduced the possibility to consistently override
dependencies within an llvm package set. I think NixOS#325175 accidentally
dropped this, so reinstate it.

Signed-off-by: Peter Waller <p@pwaller.net>
  • Loading branch information
pwaller committed Sep 15, 2024
1 parent 290ec4e commit 7d48a7a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 20 deletions.
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/common/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
officialRelease ? null,
monorepoSrc ? null,
version ? null,
# Allows passthrough to packages via newScope. This makes it possible to
# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
...
}@args:

Expand Down
49 changes: 29 additions & 20 deletions pkgs/development/compilers/llvm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
...
}@packageSetArgs:
let
versions = {
"13.0.1".officialRelease.sha256 = "06dv6h5dmvzdxbif2s8njki6h32796v368dyb5945x8gjj72xh7k";
Expand Down Expand Up @@ -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
}
)
)
);

Expand Down

0 comments on commit 7d48a7a

Please sign in to comment.