2024-10-28 16:12:41 -05:00
{
config ,
pkgs ,
. . .
} :
{
home = {
sessionVariables = {
CARGO_HOME = " ${ config . xdg . dataHome } / c a r g o " ;
RUSTUP_HOME = " ${ config . xdg . dataHome } / r u s t u p " ;
RUST_SRC_PATH = " ${ pkgs . fenix . complete . rust-src } / l i b / r u s t l i b / s r c / r u s t / l i b r a r y " ;
2024-12-13 22:42:15 -06:00
# HACK: Specify openssl info for rust, this is really not a good idea, but it saves me from
# writing per-project shell.nix or `nix-shell -p` nonsense. I'm willing to compromise for my
# laziness.
OPENSSL_DIR = " ${ pkgs . openssl . dev } " ;
OPENSSL_LIB_DIR = " ${ pkgs . openssl . out } / l i b " ;
2024-10-28 16:12:41 -05:00
} ;
packages = with pkgs ; [
( pkgs . fenix . complete . withComponents [
" c a r g o "
" c l i p p y "
" r u s t - s r c "
" r u s t c "
" r u s t f m t "
] )
rust-analyzer-nightly
cargo-watch
cargo-nextest
2024-12-13 22:42:15 -06:00
sccache
2024-10-28 16:12:41 -05:00
] ;
2024-12-13 22:42:15 -06:00
file = {
# NOTE: This improves the rust edit-build-run cycle. See https://davidlattimore.github.io/posts/2024/02/04/speeding-up-the-rust-edit-build-run-cycle.html
" ${ config . home . sessionVariables . CARGO_HOME } / c o n f i g . t o m l " . text = ''
[ build ]
rustflags = [ " - C " , " l i n k e r = ${ pkgs . clang } / b i n / c l a n g " , " - C " , " l i n k - a r g = - - l d - p a t h = ${ pkgs . mold-wrapped } / b i n / m o l d " ]
2024-10-28 16:12:41 -05:00
2024-12-13 22:42:15 -06:00
[ profile . dev ]
split-debuginfo = " u n p a c k e d "
'' ;
} ;
2024-10-28 16:12:41 -05:00
} ;
}