From 0ea1478161135e8b98f35c66016357b1d13c995c Mon Sep 17 00:00:00 2001 From: Jacob Birkett Date: Mon, 26 Aug 2024 20:27:03 -0700 Subject: [PATCH] flake: devShell: add rust nightly for tools --- flake.nix | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 32cadb0..4e038aa 100644 --- a/flake.nix +++ b/flake.nix @@ -26,12 +26,25 @@ rustToolchain = lib.importTOML ./rust-toolchain.toml; rustVersion = rustToolchain.toolchain.channel; in { - devShells = lib.mapAttrs (system: pkgs: { - default = pkgs.mkShell { + devShells = lib.mapAttrs (system: pkgs: + let + rust-stable = pkgs.rust-bin.stable.${rustVersion}.minimal.override { + extensions = [ "rust-src" "rust-docs" "clippy" ]; + }; + in { strictDeps = true; - buildInputs = [ pkgs.rust-bin.stable.${rustVersion}.default ]; - }; - }) pkgsFor; + default = pkgs.mkShell { + strictDeps = true; + packages = [ + (lib.hiPrio rust-stable) + # Use rustfmt, and other tools that require nightly features. + (pkgs.rust-bin.selectLatestNightlyWith (toolchain: + toolchain.minimal.override { + extensions = [ "rustfmt" "rust-analyzer" ]; + })) + ]; + }; + }) pkgsFor; overlays = { default = lib.composeManyExtensions [ self.overlays.${packageName} ];