File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 3434 rust' = ( rust-bin . fromRustupToolchainFile ./rust-toolchain.toml ) ;
3535 # Setup rust nix packaging
3636 craneLib = ( crane . mkLib pkgs ) . overrideToolchain ( _ : rust' ) ;
37+ stdenvSelector = p : if p . stdenv . hostPlatform . isElf then p . stdenvAdapters . useMoldLinker p . stdenv else p . stdenv ;
3738 commonArgs = {
3839 src = craneLib . cleanCargoSource ./. ;
3940 strictDeps = true ;
4041
4142 buildInputs = with pkgs ; [ openssl ] ;
4243 nativeBuildInputs = with pkgs ; [ pkg-config ] ;
44+
45+ # Use mold linker for faster builds on ELF platforms
46+ stdenv = stdenvSelector ;
4347 } ;
4448 cargoArtifacts = craneLib . buildDepsOnly commonArgs ;
4549 commonArgsWithDeps = commonArgs // {
9498 }
9599 ) ;
96100 } ;
97- devShells . default = craneLib . devShell {
101+ devShells . default = craneLib . devShell . override {
102+ mkShell = pkgs . mkShell . override {
103+ stdenv = stdenvSelector pkgs ;
104+ } ;
105+ } {
98106 # Add all build-time dependencies to the environment
99107 packages =
100108 cranePackage . buildInputs
You can’t perform that action at this time.
0 commit comments