diff --git a/pkgs/build-support/rust/build-rust-crate/default.nix b/pkgs/build-support/rust/build-rust-crate/default.nix index 9ceda041b665..dfe28cc334b5 100644 --- a/pkgs/build-support/rust/build-rust-crate/default.nix +++ b/pkgs/build-support/rust/build-rust-crate/default.nix @@ -49,6 +49,8 @@ let filename = if lib.any (x: x == "lib" || x == "rlib") dep.crateType then "${dep.metadata}.rlib" + # Adjust lib filename for crates of type proc-macro. Proc macros are compiled/run on the build platform architecture. + else if (lib.attrByPath [ "procMacro" ] false dep) then "${dep.metadata}${stdenv.buildPlatform.extensions.library}" else "${dep.metadata}${stdenv.hostPlatform.extensions.library}"; in " --extern ${opts}${name}=${dep.lib}/lib/lib${extern}-${filename}"