From 5e5a152304576b2efb3f33275b9237a47cfc3dab Mon Sep 17 00:00:00 2001 From: uku Date: Fri, 5 Jan 2024 12:20:44 +0100 Subject: [PATCH] add rust config --- programs/rust.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 programs/rust.nix diff --git a/programs/rust.nix b/programs/rust.nix new file mode 100644 index 0000000..75ed3d8 --- /dev/null +++ b/programs/rust.nix @@ -0,0 +1,20 @@ +{ + lib, + pkgs, + config, + ... +}: let + toml = pkgs.formats.toml {}; +in { + hm.home.file.".cargo/config.toml".source = toml.generate "config.toml" { + build = { + rustc-wrapper = "${lib.getExe' pkgs.sccache "sccache"}"; + target-dir = "${config.hm.home.homeDirectory}/.cargo/target"; + }; + + target.x86_64-unknown-linux-gnu = { + linker = "${lib.getExe pkgs.clang}"; + rustflags = ["-C" "link-arg=-fuse-ld=${lib.getExe pkgs.mold}"]; + }; + }; +}