From b6643be03f3fd08c0a9fef30fa477e58d00b072d Mon Sep 17 00:00:00 2001 From: TornaxO7 <50843046+TornaxO7@users.noreply.github.com> Date: Sat, 28 May 2022 14:36:32 +0200 Subject: [PATCH] add rust toolchain.toml (#386) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * modified gitignore * fixing gitignore * reomving the himalaya.iml file * applied cargo fmt * adding rust-toolchain * restoring the .gitignore file * make nix use rust-toolchain.toml * add back rustfmt and rust-analyzer to buildInputs I opened an issue to see if its the correct behaviour from the overlay: https://github.com/oxalica/rust-overlay/issues/88. * adding clippy to rust-toolchain.toml Co-authored-by: Clément DOUIN --- flake.nix | 31 +++++++++++-------------------- rust-toolchain.toml | 3 +++ 2 files changed, 14 insertions(+), 20 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/flake.nix b/flake.nix index d7c0014..061930b 100644 --- a/flake.nix +++ b/flake.nix @@ -16,19 +16,8 @@ (system: let name = "himalaya"; - pkgs = import nixpkgs { - inherit system; - overlays = [ - rust-overlay.overlay - (self: super: { - # Because rust-overlay bundles multiple rust packages - # into one derivation, specify that mega-bundle here, - # so that crate2nix will use them automatically. - rustc = self.rust-bin.stable.latest.default; - cargo = self.rust-bin.stable.latest.default; - }) - ]; - }; + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { inherit system overlays; }; in rec { # nix build @@ -68,17 +57,19 @@ # nix develop devShell = pkgs.mkShell { - RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; inputsFrom = builtins.attrValues self.packages.${system}; buildInputs = with pkgs; [ - cargo - cargo-watch - trunk - ripgrep - rust-analyzer - rustfmt + # Nix LSP + formatter rnix-lsp nixpkgs-fmt + + # Rust env + (rust-bin.fromRustupToolchainFile ./rust-toolchain.toml) + cargo-watch + rust-analyzer + rustfmt + + # Notmuch notmuch ]; }; diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..055c9f0 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.58.1" +components = ["cargo", "rustc", "rustfmt", "rust-analysis", "clippy"]