{ description = "A flake for a Rust application"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; naersk = { url = "github:nmattia/naersk/master"; inputs.nixpkgs.follows = "nixpkgs"; }; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; }; outputs = { self, nixpkgs, flake-utils, naersk, rust-overlay }: flake-utils.lib.eachDefaultSystem (system: let overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system overlays; }; naersk-lib = pkgs.callPackage naersk { }; rustToolchain = pkgs.rust-bin.stable.latest.default.override { extensions = [ "rustfmt" "clippy" ]; }; in { formatter = pkgs.nixpkgs-fmt; packages.wololo = naersk-lib.buildPackage { root = ./.; buildInputs = [ rustToolchain ]; nativeBuildInputs = with pkgs; [ cargo-edit cargo-diet cargo-feature cargo-outdated pre-commit rust-analyzer taplo ]; }; packages.default = self.packages.${system}.wololo; apps.wololo = flake-utils.lib.mkApp { drv = self.packages."${system}".default; }; apps.default = self.apps.${system}.wololo; overlays = final: prev: { wololo = self.packages.${system}.wololo; }; devShells.default = with pkgs; mkShell { inputsFrom = [ self.packages.${system}.wololo ]; }; }); }