Skip to content

Commit

Permalink
nix: only use rust-src in devShell toolchain
Browse files Browse the repository at this point in the history
See the included comment. This helps avoid a large dependency on the rustc
toolchain and helps reduce closure size for Nix users.

Partial revert of 749481e.

Signed-off-by: Austin Seipp <[email protected]>
  • Loading branch information
thoughtpolice committed Oct 19, 2024
1 parent 35e47e7 commit 20f0f2f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
pkgs.lib.all (re: builtins.match re relPath == null) regexes;
};

ourRustVersion = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.complete);
ourRustVersion = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default);

ourRustPlatform = pkgs.makeRustPlatform {
rustc = ourRustVersion;
Expand Down Expand Up @@ -147,7 +147,16 @@

devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
ourRustVersion
# NOTE (aseipp): explicitly add rust-src to the rustc compiler only in
# devShell. this in turn causes a dependency on the rust compiler src,
# which bloats the closure size by several GiB. but doing this here
# and not by default avoids the default flake install from including
# that dependency, so it's worth it
#
# relevant PR: https://github.com/rust-lang/rust/pull/129687
(ourRustVersion.override {
extensions = [ "rust-src" ];
})

# Foreign dependencies
openssl zstd libgit2 libssh2
Expand Down

0 comments on commit 20f0f2f

Please sign in to comment.