global cargo config

This commit is contained in:
janis 2025-12-29 19:38:58 +01:00
parent 291e8022ba
commit b59f5709aa
Signed by: janis
SSH key fingerprint: SHA256:bB1qbbqmDXZNT0KKD5c2Dfjg53JGhj7B3CFcLIzSqq8

View file

@ -1,4 +1,48 @@
{pkgs, ...}: { {pkgs, ...}: {
# home.packages = with 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",
]
'';
} }