add rust toolchain.toml (#386)

* 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 <clement.douin@posteo.net>
This commit is contained in:
TornaxO7 2022-05-28 14:36:32 +02:00 committed by GitHub
parent bed5a3856b
commit b6643be03f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 20 deletions

View file

@ -16,19 +16,8 @@
(system: (system:
let let
name = "himalaya"; name = "himalaya";
pkgs = import nixpkgs { overlays = [ (import rust-overlay) ];
inherit system; pkgs = import nixpkgs { inherit system overlays; };
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;
})
];
};
in in
rec { rec {
# nix build # nix build
@ -68,17 +57,19 @@
# nix develop # nix develop
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
inputsFrom = builtins.attrValues self.packages.${system}; inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = with pkgs; [ buildInputs = with pkgs; [
cargo # Nix LSP + formatter
cargo-watch
trunk
ripgrep
rust-analyzer
rustfmt
rnix-lsp rnix-lsp
nixpkgs-fmt nixpkgs-fmt
# Rust env
(rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
cargo-watch
rust-analyzer
rustfmt
# Notmuch
notmuch notmuch
]; ];
}; };

3
rust-toolchain.toml Normal file
View file

@ -0,0 +1,3 @@
[toolchain]
channel = "1.58.1"
components = ["cargo", "rustc", "rustfmt", "rust-analysis", "clippy"]