Skip to content

Commit faac847

Browse files
committed
fix(nix): let auto-patchelf resolve cargo-hawk's compiler library
runtimeDependencies put the toolchain on the RUNPATH but left the dependency reported as unsatisfied, because auto-patchelf resolves against the library set derived from buildInputs and only writes runtimeDependencies into the RUNPATH. The pinned toolchain does carry the exact file the published binary asks for: the upstream rustc 1.97.1 archive for x86_64-unknown-linux-gnu ships librustc_driver-832cf6cfb1386559.so, the name in the CI failure, so moving the toolchain into buildInputs makes the search find it instead of ignoring it.
1 parent d937ebf commit faac847

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎nix/cargo-hawk.nix‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,17 @@ stdenvNoCC.mkDerivation {
5454
# The prebuilt Linux archives are ordinary glibc binaries, so they need the loader
5555
# and rpath fixups; the Darwin ones resolve through @rpath as shipped.
5656
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
57-
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ stdenv.cc.cc.lib ];
5857
# cargo-hawk-driver has a hard dependency on the compiler's librustc_driver, which
5958
# is the concrete form of "only runs on the toolchain it was built against". The
6059
# pinned toolchain carries the matching file because rust-overlay repackages the
61-
# same upstream release: 1.97.1 ships librustc_driver-e03ed1db822dfa4c, which is
62-
# what the published binary asks for.
63-
runtimeDependencies = lib.optionals stdenv.hostPlatform.isLinux [ rustToolchain ];
60+
# same upstream release, so it belongs in buildInputs rather than
61+
# runtimeDependencies: the latter is written into the RUNPATH but is not part of
62+
# the library set auto-patchelf resolves against, so the dependency is reported
63+
# unsatisfied even once the path is on the RUNPATH.
64+
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
65+
stdenv.cc.cc.lib
66+
rustToolchain
67+
];
6468

6569
installPhase = ''
6670
runHook preInstall

0 commit comments

Comments
 (0)