{ description = "Flakes for Rust development"; inputs = { # The nixpkgs nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # Utility functions flake-utils.url = "github:numtide/flake-utils"; # An nixpkgs overlay for overriding the nixpkgs to get declarative Rust toolchain specification. rust-overlay.url = "github:oxalica/rust-overlay"; }; outputs = { self, nixpkgs, flake-utils, rust-overlay }: flake-utils.lib.eachDefaultSystem (system: let overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system overlays; }; rs-toolchain = pkgs.rust-bin.stable.latest.default.override { extensions = [ "rust-src" ]; }; in { devShells.default = pkgs.mkShell { buildInputs = [ # Including latest cargo,clippy,cargo-fmt rs-toolchain # rust-analyzer comes from nixpkgs toolchain, I want the unwrapped version pkgs.rust-analyzer-unwrapped pkgs.cargo-expand pkgs.openssl ]; # To make rust-analyzer work correctly (The path prefix issue) RUST_SRC_PATH = "${rs-toolchain}/lib/rustlib/src/rust/library"; }; }); }