{ inputs = { flake-utils.url = "github:numtide/flake-utils"; naersk.url = "github:nix-community/naersk"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; rust-overlay.url = "github:oxalica/rust-overlay"; }; outputs = { self, flake-utils, naersk, nixpkgs, rust-overlay, ... }: flake-utils.lib.eachDefaultSystem (system: let overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system overlays; }; toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain; naersk' = pkgs.callPackage naersk { cargo = toolchain; rustc = toolchain; }; in rec { # For `nix build` & `nix run`: defaultPackage = naersk'.buildPackage { src = ./.; }; # For `nix develop`: devShell = pkgs.mkShell { nativeBuildInputs = [ toolchain ]; }; }); }