From 3ad14a95a650f94b9fb4621b6c19d5ffd572cfc5 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 30 Nov 2025 17:23:57 +0300 Subject: [PATCH] meta: build with Mold linker on x86_64 Linux Signed-off-by: NotAShelf Change-Id: Id51e62dda1ec2ba895ffdbbd25c2f1256a6a6964 --- .cargo/config.toml | 4 ++++ nix/shell.nix | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..b7efcee --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,4 @@ +# https://github.com/rui314/mold?tab=readme-ov-file#how-to-use +[target.'cfg(target_os = "linux")'] +linker = "clang" +rustflags = ["-C", "link-arg=-fuse-ld=mold"] diff --git a/nix/shell.nix b/nix/shell.nix index 111b803..ae65e10 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -1,27 +1,31 @@ { mkShell, + cargo, + rustc, + mold, + clang, rust-analyzer-unwrapped, rustfmt, clippy, - cargo, taplo, - rustc, rustPlatform, gnuplot, }: mkShell { + name = "microfetch"; strictDeps = true; - nativeBuildInputs = [ cargo rustc + mold + clang rust-analyzer-unwrapped (rustfmt.override {asNightly = true;}) clippy taplo - gnuplot # For Criterion.rs plots + gnuplot # for Criterion.rs plots ]; env.RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";