{
  inputs = {
    # Use espflash <4.0.0 until https://github.com/esp-rs/espflash/pull/975 is put into nixpkgs
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    rust-overlay.url = "github:oxalica/rust-overlay";
    flake-utils.url = "github:numtide/flake-utils";
    esp-rs.url = "github:aljazerzen/nixpkgs-esp-dev-rust";
  };

  outputs =
    {
      nixpkgs,
      rust-overlay,
      flake-utils,
      esp-rs,
      ...
    }:
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        overlays = [
          (import rust-overlay)
        ];
        pkgs = import nixpkgs {
          inherit system overlays;
        };
      in
      {
        devShells.default =
          with pkgs;
          mkShell {
            buildInputs = [
              (rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
              rust-analyzer
              # Used by cargo run
              espflash
              probe-rs-tools
            ];
          };
      }
    );
}
