Skip to content

Commit

Permalink
llvmPackages_{12,13,14,15,16,17,18,git}: Allow overriding dependencies
Browse files Browse the repository at this point in the history
... consistently.

Further to NixOS#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 { <dependency> = ...; }`.

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 <[email protected]>
  • Loading branch information
pwaller committed Jun 16, 2024
1 parent 683aa7c commit 40a7f21
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 19 deletions.
10 changes: 7 additions & 3 deletions pkgs/development/compilers/llvm/12/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -17,6 +17,10 @@
then null
else pkgs.bintools
, darwin
# 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:

let
Expand Down
11 changes: 7 additions & 4 deletions pkgs/development/compilers/llvm/13/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:

assert
Expand Down
9 changes: 7 additions & 2 deletions pkgs/development/compilers/llvm/14/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:

assert
Expand Down
9 changes: 7 additions & 2 deletions pkgs/development/compilers/llvm/15/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:

assert
Expand Down
9 changes: 7 additions & 2 deletions pkgs/development/compilers/llvm/16/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:

assert
Expand Down
9 changes: 7 additions & 2 deletions pkgs/development/compilers/llvm/17/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:

assert
Expand Down
9 changes: 7 additions & 2 deletions pkgs/development/compilers/llvm/18/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:

assert
Expand Down
9 changes: 7 additions & 2 deletions pkgs/development/compilers/llvm/git/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:

assert
Expand Down

0 comments on commit 40a7f21

Please sign in to comment.