From 8713102f77f26c68ad26fa8ae7be173fa750533d Mon Sep 17 00:00:00 2001 From: Roman Volosatovs Date: Wed, 19 Jul 2023 14:21:02 +0200 Subject: [PATCH] feat(rust): use mold linker for Linux targets Signed-off-by: Roman Volosatovs --- lib/rust/mkAttrs.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/rust/mkAttrs.nix b/lib/rust/mkAttrs.nix index 1f8c535..4d8d9f6 100644 --- a/lib/rust/mkAttrs.nix +++ b/lib/rust/mkAttrs.nix @@ -296,6 +296,13 @@ with self.lib.rust.targets; CARGO_BUILD_TARGET = target; } + // optionalAttrs pkgsCross.stdenv.hostPlatform.isLinux { + nativeBuildInputs = [ + final.mold + ]; + + RUSTFLAGS = "-Clink-arg=-fuse-ld=mold"; + } // optionalAttrs (final.stdenv.buildPlatform.config != pkgsCross.stdenv.hostPlatform.config) ( { strictDeps = true;