From 311bf24d85f6f658f8d2edaa56904e751efda48a Mon Sep 17 00:00:00 2001
From: Peter Waller
Date: Sun, 16 Jun 2024 14:47:45 +0100
Subject: [PATCH] llvmPackages_{12,13,14,15,16,17,18,git}: Allow overriding
dependencies
... consistently.
Further to #307211, allow overriding arguments through llvmPackages.override.
This makes it possible to override any dependency of LLVM or
clang by overriding it on `llvmPackages.override { = ...; }`.
This is useful in development or customization where sometimes it is
desirable to turn features on or off.
Without this patch the only way to for example override ncurses was to
do `overriddenLLVM = llvmPackages.llvm.override { ncurses }`, but then
you would have to thread `overriddenLLVM` as dependencies into clang and
other packages, which results in quite a difficult expression to write
correctly in cross compilation scenarios.
Signed-off-by: Peter Waller
(cherry picked from commit 40a7f218c554ef239062629b7db97bf1beedca58)
---
pkgs/development/compilers/llvm/12/default.nix | 10 +++++++---
pkgs/development/compilers/llvm/13/default.nix | 11 +++++++----
pkgs/development/compilers/llvm/14/default.nix | 9 +++++++--
pkgs/development/compilers/llvm/15/default.nix | 9 +++++++--
pkgs/development/compilers/llvm/16/default.nix | 9 +++++++--
pkgs/development/compilers/llvm/17/default.nix | 9 +++++++--
pkgs/development/compilers/llvm/18/default.nix | 9 +++++++--
pkgs/development/compilers/llvm/git/default.nix | 9 +++++++--
8 files changed, 56 insertions(+), 19 deletions(-)
diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix
index d3b823215c52..0e498aa30356 100644
--- a/pkgs/development/compilers/llvm/12/default.nix
+++ b/pkgs/development/compilers/llvm/12/default.nix
@@ -1,7 +1,7 @@
-{ lowPrio, newScope, pkgs, lib, stdenv, cmake
+{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
-, substitute, substituteAll, fetchFromGitHub, fetchpatch
-, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
+, substitute, substituteAll, fetchFromGitHub, fetchpatch, fetchurl
+, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@@ -17,6 +17,10 @@
then null
else pkgs.bintools
, darwin
+# 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:
let
diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix
index 0b231a91512b..22bdc6140ab3 100644
--- a/pkgs/development/compilers/llvm/13/default.nix
+++ b/pkgs/development/compilers/llvm/13/default.nix
@@ -1,7 +1,7 @@
-{ lowPrio, newScope, pkgs, lib, stdenv, cmake
+{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
-, fetchpatch
-, libxml2, python3, isl, fetchFromGitHub, substitute, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
+, substitute, substituteAll, fetchFromGitHub, fetchpatch
+, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@@ -40,7 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? 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:
assert
diff --git a/pkgs/development/compilers/llvm/14/default.nix b/pkgs/development/compilers/llvm/14/default.nix
index a80b3aa4ffff..22fd8223c8f2 100644
--- a/pkgs/development/compilers/llvm/14/default.nix
+++ b/pkgs/development/compilers/llvm/14/default.nix
@@ -1,6 +1,7 @@
-{ lowPrio, newScope, pkgs, lib, stdenv, cmake
+{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
-, libxml2, python3, fetchFromGitHub, substitute, substituteAll, fetchpatch, overrideCC, wrapCCWith, wrapBintoolsWith
+, substitute, substituteAll, fetchFromGitHub, fetchpatch
+, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@@ -39,6 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? 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:
assert
diff --git a/pkgs/development/compilers/llvm/15/default.nix b/pkgs/development/compilers/llvm/15/default.nix
index e30e9f9a59db..b3d2d9c3de48 100644
--- a/pkgs/development/compilers/llvm/15/default.nix
+++ b/pkgs/development/compilers/llvm/15/default.nix
@@ -1,6 +1,7 @@
-{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
+{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
-, libxml2, python3, fetchFromGitHub, fetchpatch, substitute, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
+, substitute, substituteAll, fetchFromGitHub, fetchpatch
+, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@@ -39,6 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? 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:
assert
diff --git a/pkgs/development/compilers/llvm/16/default.nix b/pkgs/development/compilers/llvm/16/default.nix
index 426bcb4c46d8..521e1ed92e3e 100644
--- a/pkgs/development/compilers/llvm/16/default.nix
+++ b/pkgs/development/compilers/llvm/16/default.nix
@@ -1,6 +1,7 @@
-{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
+{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
-, libxml2, python3, fetchFromGitHub, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
+, substitute, substituteAll, fetchFromGitHub
+, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@@ -39,6 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? 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:
assert
diff --git a/pkgs/development/compilers/llvm/17/default.nix b/pkgs/development/compilers/llvm/17/default.nix
index a6d7f48eb800..af0d648c4fd0 100644
--- a/pkgs/development/compilers/llvm/17/default.nix
+++ b/pkgs/development/compilers/llvm/17/default.nix
@@ -1,6 +1,7 @@
-{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
+{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
-, libxml2, python3, fetchFromGitHub, fetchpatch, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
+, substitute, substituteAll, fetchFromGitHub, fetchpatch
+, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@@ -39,6 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? 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:
assert
diff --git a/pkgs/development/compilers/llvm/18/default.nix b/pkgs/development/compilers/llvm/18/default.nix
index d62ae9c820b2..4ef972870838 100644
--- a/pkgs/development/compilers/llvm/18/default.nix
+++ b/pkgs/development/compilers/llvm/18/default.nix
@@ -1,6 +1,7 @@
-{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
+{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
-, libxml2, python3, fetchFromGitHub, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
+, substitute, substituteAll, fetchFromGitHub
+, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@@ -39,6 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? 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:
assert
diff --git a/pkgs/development/compilers/llvm/git/default.nix b/pkgs/development/compilers/llvm/git/default.nix
index 6ef923b65409..27f6313e9dec 100644
--- a/pkgs/development/compilers/llvm/git/default.nix
+++ b/pkgs/development/compilers/llvm/git/default.nix
@@ -1,6 +1,7 @@
-{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
+{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
-, libxml2, python3, fetchFromGitHub, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
+, substitute, substituteAll, fetchFromGitHub, fetchpatch
+, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@@ -44,6 +45,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? 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:
assert