forked from mirrors/jj
feat(nix): use mold by default for linking inside 'nix develop'
Summary: Pure QOL improvement, not that this was too awful as it stood. But this ultimately makes all builds faster, effectively for free; on my Linux machine, debug link time for jj-cli goes from 3s to 1s. Signed-off-by: Austin Seipp <aseipp@pobox.com> Change-Id: I5a0d516363635710733e8bee8f208050
This commit is contained in:
parent
154ab9e283
commit
e212e10dee
1 changed files with 11 additions and 1 deletions
12
flake.nix
12
flake.nix
|
@ -24,6 +24,7 @@
|
|||
rust-overlay.overlays.default
|
||||
];
|
||||
};
|
||||
|
||||
filterSrc = src: regexes:
|
||||
pkgs.lib.cleanSourceWith {
|
||||
inherit src;
|
||||
|
@ -33,6 +34,11 @@
|
|||
in
|
||||
pkgs.lib.all (re: builtins.match re relPath == null) regexes;
|
||||
};
|
||||
|
||||
# NOTE (aseipp): on Linux, go ahead and use mold by default to improve
|
||||
# link times a bit; mostly useful for debug build speed, but will help
|
||||
# over time if we ever get more dependencies, too
|
||||
useMoldLinker = pkgs.stdenv.isLinux;
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
|
@ -118,12 +124,16 @@
|
|||
cargo-insta
|
||||
cargo-nextest
|
||||
cargo-watch
|
||||
];
|
||||
|
||||
# Extra, more specific tools follow
|
||||
] ++ pkgs.lib.optionals useMoldLinker [ mold ];
|
||||
|
||||
shellHook = ''
|
||||
export RUST_BACKTRACE=1
|
||||
export ZSTD_SYS_USE_PKG_CONFIG=1
|
||||
export LIBSSH2_SYS_USE_PKG_CONFIG=1
|
||||
'' + pkgs.lib.optionalString useMoldLinker ''
|
||||
export RUSTFLAGS="-C link-arg=-fuse-ld=mold $RUSTFLAGS"
|
||||
'';
|
||||
};
|
||||
}));
|
||||
|
|
Loading…
Reference in a new issue