{ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; rust-overlay.url = "github:oxalica/rust-overlay"; treefmt-nix = { url = "github:numtide/treefmt-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, rust-overlay, treefmt-nix, ... }: let lib = nixpkgs.lib; supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; forEachSupportedSystem = f: lib.genAttrs supportedSystems (system: f { pkgs = import nixpkgs { inherit system; overlays = [(import rust-overlay)]; }; }); treefmtEval = forEachSupportedSystem ({pkgs}: treefmt-nix.lib.evalModule pkgs ./treefmt.nix); in { devShells = forEachSupportedSystem ({pkgs}: let rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./toolchain.toml; in { default = pkgs.mkShell { packages = with pkgs; [ rustToolchain rust-analyzer-unwrapped ]; env = { RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; }; }; }); formatter = forEachSupportedSystem ({pkgs}: treefmtEval.${pkgs.stdenv.hostPlatform.system}.config.build.wrapper); checks = forEachSupportedSystem ({pkgs}: { formatting = treefmtEval.${pkgs.stdenv.hostPlatform.system}.config.build.check self; }); }; }