From 4a2983b77ec10da66b27fd5625ec4da3451c6a0a Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Thu, 17 Oct 2024 16:46:48 -0500 Subject: [PATCH] nix: only use `rust-src` in `devShell` toolchain 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 749481e5527c092da9096504e08c6aa065f598bb. Signed-off-by: Austin Seipp --- flake.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 7089f5812..a33e6f62d 100644 --- a/flake.nix +++ b/flake.nix @@ -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; @@ -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