{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; crane = { url = "github:ipetkov/crane"; }; }; outputs = { self, nixpkgs, flake-utils, fenix, crane }: flake-utils.lib.eachDefaultSystem ( system: let overlays = [fenix.overlays.default]; pkgs = import nixpkgs { inherit system overlays; }; craneLib = crane.mkLib pkgs; commonArgs = { src = craneLib.cleanCargoSource ./.; strictDeps = true; nativeBuildInputs = with pkgs; [pkg-config cmake]; buildInputs = with pkgs; [ openssl zlib-ng ] ++ lib.optionals stdenv.isDarwin [ libiconv ]; }; in with pkgs; { devShells.default = mkShell { buildInputs = [ pkgs.fenix.stable.completeToolchain pkg-config openssl ]; }; formatter = pkgs.alejandra; packages.default = craneLib.buildPackage (commonArgs // { cargoArtifacts = craneLib.buildDepsOnly commonArgs; }); } ); }