From cdefc40e99a2a6781b7493135be58d8c6c418b19 Mon Sep 17 00:00:00 2001 From: Peter Waller Date: Fri, 8 Nov 2024 12:48:25 +0000 Subject: [PATCH] llvmPackages.*: Expose git rev through pkg.src.rev Also exposes owner, repo, and other attributes available on the original monorepoSrc. These attributes were previously hidden behind a runCommand that consumes monorepoSrc and hides this information away. ``` $ nix eval --raw .#llvmPackages_18.llvm.src.rev llvmorg-18.1.8 $ nix eval --raw .#llvmPackages_git.llvm.src.rev 0e8555d4dbfdfeddc01dc2ecf9a9b6e804f7b645 ``` Signed-off-by: Peter Waller --- pkgs/development/compilers/llvm/common/bintools.nix | 1 + pkgs/development/compilers/llvm/common/bolt/default.nix | 2 +- pkgs/development/compilers/llvm/common/clang/default.nix | 2 +- pkgs/development/compilers/llvm/common/common-let.nix | 3 ++- pkgs/development/compilers/llvm/common/compiler-rt/default.nix | 2 +- pkgs/development/compilers/llvm/common/libclc.nix | 2 +- pkgs/development/compilers/llvm/common/libcxx/default.nix | 2 +- pkgs/development/compilers/llvm/common/libunwind/default.nix | 2 +- pkgs/development/compilers/llvm/common/lld/default.nix | 2 +- pkgs/development/compilers/llvm/common/lldb.nix | 2 +- pkgs/development/compilers/llvm/common/llvm/default.nix | 2 +- pkgs/development/compilers/llvm/common/mlir/default.nix | 2 +- pkgs/development/compilers/llvm/common/openmp/default.nix | 2 +- 13 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pkgs/development/compilers/llvm/common/bintools.nix b/pkgs/development/compilers/llvm/common/bintools.nix index 85b570d976ae..5cd8ecc251d9 100644 --- a/pkgs/development/compilers/llvm/common/bintools.nix +++ b/pkgs/development/compilers/llvm/common/bintools.nix @@ -9,6 +9,7 @@ runCommand "llvm-binutils-${version}" passthru = { isLLVM = true; inherit targetPrefix; + inherit llvm lld; }; } ('' diff --git a/pkgs/development/compilers/llvm/common/bolt/default.nix b/pkgs/development/compilers/llvm/common/bolt/default.nix index d62841b48d0a..1662aa52dde2 100644 --- a/pkgs/development/compilers/llvm/common/bolt/default.nix +++ b/pkgs/development/compilers/llvm/common/bolt/default.nix @@ -21,7 +21,7 @@ stdenv.mkDerivation (finalAttrs: { inherit version patches; # Blank llvm dir just so relative path works - src = runCommand "bolt-src-${finalAttrs.version}" { } ( + src = runCommand "bolt-src-${finalAttrs.version}" { inherit (monorepoSrc) passthru; } ( '' mkdir $out '' diff --git a/pkgs/development/compilers/llvm/common/clang/default.nix b/pkgs/development/compilers/llvm/common/clang/default.nix index 45b8090d8214..ee2adc09ba6e 100644 --- a/pkgs/development/compilers/llvm/common/clang/default.nix +++ b/pkgs/development/compilers/llvm/common/clang/default.nix @@ -24,7 +24,7 @@ let pname = "clang"; src' = if monorepoSrc != null then - runCommand "${pname}-src-${version}" {} ('' + runCommand "${pname}-src-${version}" { inherit (monorepoSrc) passthru; } ('' mkdir -p "$out" '' + lib.optionalString (lib.versionAtLeast release_version "14") '' cp -r ${monorepoSrc}/cmake "$out" diff --git a/pkgs/development/compilers/llvm/common/common-let.nix b/pkgs/development/compilers/llvm/common/common-let.nix index f87af997361c..2bcff464b436 100644 --- a/pkgs/development/compilers/llvm/common/common-let.nix +++ b/pkgs/development/compilers/llvm/common/common-let.nix @@ -53,10 +53,11 @@ rec { else "llvmorg-${releaseInfo.version}"; in - fetchFromGitHub { + fetchFromGitHub rec { owner = "llvm"; repo = "llvm-project"; inherit rev sha256; + passthru = { inherit owner repo rev; }; }; } diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix index 241fad158c3c..50d343f432c6 100644 --- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix @@ -56,7 +56,7 @@ let apple-sdk.override { enableBootstrap = true; }; src' = if monorepoSrc != null then - runCommand "${baseName}-src-${version}" {} ('' + runCommand "${baseName}-src-${version}" { inherit (monorepoSrc) passthru; } ('' mkdir -p "$out" '' + lib.optionalString (lib.versionAtLeast release_version "14") '' cp -r ${monorepoSrc}/cmake "$out" diff --git a/pkgs/development/compilers/llvm/common/libclc.nix b/pkgs/development/compilers/llvm/common/libclc.nix index c24fc6e3b4c0..f6a21adfc6a2 100644 --- a/pkgs/development/compilers/llvm/common/libclc.nix +++ b/pkgs/development/compilers/llvm/common/libclc.nix @@ -22,7 +22,7 @@ stdenv.mkDerivation rec { pname = "libclc"; inherit version; - src = runCommand "${pname}-src-${version}" { } ( + src = runCommand "${pname}-src-${version}" { inherit (monorepoSrc) passthru; } ( '' mkdir -p "$out" '' diff --git a/pkgs/development/compilers/llvm/common/libcxx/default.nix b/pkgs/development/compilers/llvm/common/libcxx/default.nix index d4b727bd50d2..3f57e6c55ca6 100644 --- a/pkgs/development/compilers/llvm/common/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/common/libcxx/default.nix @@ -34,7 +34,7 @@ let useLLVM = stdenv.hostPlatform.useLLVM or false; src' = if monorepoSrc != null then - runCommand "${pname}-src-${version}" {} ('' + runCommand "${pname}-src-${version}" { inherit (monorepoSrc) passthru; } ('' mkdir -p "$out/llvm" '' + (lib.optionalString (lib.versionAtLeast release_version "14") '' cp -r ${monorepoSrc}/cmake "$out" diff --git a/pkgs/development/compilers/llvm/common/libunwind/default.nix b/pkgs/development/compilers/llvm/common/libunwind/default.nix index 63b9737092b8..68d52006db33 100644 --- a/pkgs/development/compilers/llvm/common/libunwind/default.nix +++ b/pkgs/development/compilers/llvm/common/libunwind/default.nix @@ -17,7 +17,7 @@ let pname = "libunwind"; src' = if monorepoSrc != null then - runCommand "${pname}-src-${version}" {} ('' + runCommand "${pname}-src-${version}" { inherit (monorepoSrc) passthru; } ('' mkdir -p "$out" '' + lib.optionalString (lib.versionAtLeast release_version "14") '' cp -r ${monorepoSrc}/cmake "$out" diff --git a/pkgs/development/compilers/llvm/common/lld/default.nix b/pkgs/development/compilers/llvm/common/lld/default.nix index 32cf5cb46460..4daa3243fc4c 100644 --- a/pkgs/development/compilers/llvm/common/lld/default.nix +++ b/pkgs/development/compilers/llvm/common/lld/default.nix @@ -19,7 +19,7 @@ let pname = "lld"; src' = if monorepoSrc != null then - runCommand "lld-src-${version}" {} ('' + runCommand "lld-src-${version}" { inherit (monorepoSrc) passthru; } ('' mkdir -p "$out" '' + lib.optionalString (lib.versionAtLeast release_version "14") '' cp -r ${monorepoSrc}/cmake "$out" diff --git a/pkgs/development/compilers/llvm/common/lldb.nix b/pkgs/development/compilers/llvm/common/lldb.nix index 1e2233790738..1c37f27da8d8 100644 --- a/pkgs/development/compilers/llvm/common/lldb.nix +++ b/pkgs/development/compilers/llvm/common/lldb.nix @@ -32,7 +32,7 @@ let src' = if monorepoSrc != null then - runCommand "lldb-src-${version}" { } ('' + runCommand "lldb-src-${version}" { inherit (monorepoSrc) passthru; } ('' mkdir -p "$out" '' + lib.optionalString (lib.versionAtLeast release_version "14") '' cp -r ${monorepoSrc}/cmake "$out" diff --git a/pkgs/development/compilers/llvm/common/llvm/default.nix b/pkgs/development/compilers/llvm/common/llvm/default.nix index bd384108408c..fbd99685a957 100644 --- a/pkgs/development/compilers/llvm/common/llvm/default.nix +++ b/pkgs/development/compilers/llvm/common/llvm/default.nix @@ -85,7 +85,7 @@ let # TODO: simplify versionAtLeast condition for cmake and third-party via rebuild src' = if monorepoSrc != null then - runCommand "${pname}-src-${version}" {} ('' + runCommand "${pname}-src-${version}" { inherit (monorepoSrc) passthru; } ('' mkdir -p "$out" '' + lib.optionalString (lib.versionAtLeast release_version "14") '' cp -r ${monorepoSrc}/cmake "$out" diff --git a/pkgs/development/compilers/llvm/common/mlir/default.nix b/pkgs/development/compilers/llvm/common/mlir/default.nix index 9c3c71c3b705..b35a05320a5c 100644 --- a/pkgs/development/compilers/llvm/common/mlir/default.nix +++ b/pkgs/development/compilers/llvm/common/mlir/default.nix @@ -19,7 +19,7 @@ stdenv.mkDerivation rec { inherit version doCheck; # Blank llvm dir just so relative path works - src = runCommand "${pname}-src-${version}" { } ('' + src = runCommand "${pname}-src-${version}" { inherit (monorepoSrc) passthru; } ('' mkdir -p "$out" '' + lib.optionalString (lib.versionAtLeast release_version "14") '' cp -r ${monorepoSrc}/cmake "$out" diff --git a/pkgs/development/compilers/llvm/common/openmp/default.nix b/pkgs/development/compilers/llvm/common/openmp/default.nix index 1ad5948edb86..548f19b9a603 100644 --- a/pkgs/development/compilers/llvm/common/openmp/default.nix +++ b/pkgs/development/compilers/llvm/common/openmp/default.nix @@ -21,7 +21,7 @@ let pname = "openmp"; src' = if monorepoSrc != null then - runCommand "${pname}-src-${version}" {} ('' + runCommand "${pname}-src-${version}" { inherit (monorepoSrc) passthru; } ('' mkdir -p "$out" '' + lib.optionalString (lib.versionAtLeast release_version "14") '' cp -r ${monorepoSrc}/cmake "$out"