{ description = "IPFS deploy tool"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/release-22.11"; flake-utils.url = "github:numtide/flake-utils"; fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; naersk = { url = "github:nix-community/naersk"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, flake-utils, fenix, naersk }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages."${system}"; mkToolchain = fenix.packages.${system}.combine; toolchain = fenix.packages.${system}.stable; buildToolchain = mkToolchain (with toolchain; [ cargo rustc ]); devToolchain = mkToolchain (with toolchain; [ cargo clippy rust-src rustc rust-analyzer # Always use nightly rustfmt because most of its options are unstable fenix.packages.${system}.latest.rustfmt ]); in { packages.default = (pkgs.callPackage naersk { cargo = buildToolchain; rustc = buildToolchain; }).buildPackage { src = ./.; }; # `nix develop` devShells.default = pkgs.mkShell { name = "marvin"; RUST_SRC_PATH = "${devToolchain}/lib/rustlib/src/rust/library"; nativeBuildInputs = [ devToolchain pkgs.nixpkgs-fmt pkgs.libiconv ]; }; checks = { packagesDefault = self.packages.${system}.default; devShellsDefault = self.devShells.${system}.default; }; }); }