nixos-config/home/development/rust.nix
2025-12-29 19:38:58 +01:00

49 lines
1.1 KiB
Nix

{pkgs, ...}: {
# home.packages = with pkgs; [
# ];
home.file.".cargo/config.toml".text = ''
[unstable]
codegen-backend = true
[profile.dev]
codegen-backend = "cranelift"
[profile.dev.package."*"]
codegen-backend = "llvm"
# Consider compiling deps with cranelift if you want cold-compilation to be faster
# codegen-backend = "cranelift"
# cranelift is `panic = abort`, so you need to compile with llvm to get `#[should_panic]` working
[profile.test.package."*"]
codegen-backend = "llvm"
# Disable cranelift for release profile
[profile.release]
codegen-backend = "llvm"
# cranelift cannot build wasm32-unknown-unknown out of the box
[profile.web]
codegen-backend = "llvm"
[build]
# Using a global target dir allows all projects to share incremental compilation results,
# vastly speeding up cold-compilation of new projects.
target-dir = "/var/code/rust/.cargo/global-target"
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = [
"-Clink-arg=--ld-path=mold",
# Compile faster
"-Zshare-generics=y",
"-Zthreads=12",
]
rustdocflags = [
# Compile faster
"-Zshare-generics=y",
"-Zthreads=12",
]
'';
}