Skip to content

Commit d937ebf

Browse files
committed
fix(nix): resolve cargo-hawk's compiler library on Linux
The Linux build failed in CI with auto-patchelf unable to satisfy librustc_driver-832cf6cfb1386559.so and libgcc_s.so.1. That dependency is the concrete form of hawk's "only runs on the toolchain it was built against": its driver links the compiler's shared library directly, and Darwin resolved it through @rpath while Linux needs it on the search path. The pinned toolchain carries the matching file because rust-overlay repackages the same upstream release, so it goes into runtimeDependencies rather than being vendored — verified on Darwin, where the published binary asks for librustc_driver-e03ed1db822dfa4c and 1.97.1 ships exactly that.
1 parent a0dfc12 commit d937ebf

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎nix/cargo-hawk.nix‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
stdenv,
1212
stdenvNoCC,
1313
autoPatchelfHook,
14+
rustToolchain,
1415
}:
1516
let
1617
version = "0.1.10";
@@ -50,9 +51,16 @@ stdenvNoCC.mkDerivation {
5051
# The archive holds a single cargo-hawk-<target>/ directory.
5152
sourceRoot = "cargo-hawk-${archive.target}";
5253

53-
# The prebuilt Linux archives are ordinary glibc binaries, so they need the
54-
# loader and rpath fixups; the Darwin ones run as shipped.
54+
# The prebuilt Linux archives are ordinary glibc binaries, so they need the loader
55+
# and rpath fixups; the Darwin ones resolve through @rpath as shipped.
5556
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
57+
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ stdenv.cc.cc.lib ];
58+
# cargo-hawk-driver has a hard dependency on the compiler's librustc_driver, which
59+
# is the concrete form of "only runs on the toolchain it was built against". The
60+
# 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 ];
5664

5765
installPhase = ''
5866
runHook preInstall

‎nix/packages.nix‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ in
3333
bun2nix = inputs.bun2nix.packages.${system}.default;
3434
};
3535
bunCli = pkgs.callPackage ../nix/bun-cli.nix { inherit bunNodeModules; };
36-
cargo-hawk = pkgs.callPackage ../nix/cargo-hawk.nix { };
36+
cargo-hawk = pkgs.callPackage ../nix/cargo-hawk.nix {
37+
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile (root + /rust-toolchain.toml);
38+
};
3739
changelogithub = pkgs.callPackage ../nix/tools/changelogithub { inherit bunCli; };
3840
# Regeneration-only output for committed models.dev snapshots;
3941
# `just gen-models-dev-pricing` builds this and copies them into the source

0 commit comments

Comments
 (0)