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 <p@pwaller.net>
This commit is contained in:
Peter Waller
2024-11-09 15:12:56 +00:00
parent 6011527ff3
commit cdefc40e99
13 changed files with 14 additions and 12 deletions
@@ -9,6 +9,7 @@ runCommand "llvm-binutils-${version}"
passthru = {
isLLVM = true;
inherit targetPrefix;
inherit llvm lld;
};
}
(''
@@ -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
''
@@ -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"
@@ -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; };
};
}
@@ -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"
@@ -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"
''
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"