···6767 # Use the toolchain with the crane helper functions
6868 craneLib = (inputs.crane.mkLib pkgs).overrideToolchain toolChain;
69697070- # Clean the src to only have the Rust-relevant files
7171- src = craneLib.cleanCargoSource (craneLib.path ./.);
7272-7370 # Common arguments for mkCargoDerivation, a helper for the crane functions
7471 # Arguments can be included here even if they aren't used, but we only
7572 # place them here if they would otherwise show up in multiple places
7673 commonArgs = {
7777- inherit src cargoArtifacts;
7878- meta.mainProgram = "cmprss";
7474+ inherit cargoArtifacts;
7575+ # Clean the src to only have the Rust-relevant files
7676+ src = craneLib.cleanCargoSource ./.;
7777+ strictDeps = true;
7978 };
80798180 # Build only the cargo dependencies so we can cache them all when running in CI
8281 cargoArtifacts = craneLib.buildDepsOnly commonArgs;
83828483 # Build the actual crate itself, reusing the cargoArtifacts
8585- cmprss = craneLib.buildPackage commonArgs;
8484+ cmprss = craneLib.buildPackage (commonArgs // {meta.mainProgram = "cmprss";});
8685 in {
8786 checks = {
8887 # Build the crate as part of `nix flake check` for convenience
···105104 nextest = craneLib.cargoNextest commonArgs;
106105 };
107106107107+ # This also sets up `nix fmt` to run all formatters
108108 treefmt = {
109109 projectRootFile = ./flake.nix;
110110 programs = {
···153153 '';
154154155155 # Include the packages from the defined checks and packages
156156+ # Installs the full cargo toolchain and the extra tools, e.g. cargo-tarpaulin.
156157 inputsFrom =
157158 (builtins.attrValues self.checks.${system})
158159 ++ (builtins.attrValues self.packages.${system});
159160160161 # Extra inputs can be added here
161161- nativeBuildInputs = with pkgs; [
162162+ packages = with pkgs; [
162163 act # For running Github Actions locally
163164 alejandra
164165 deadnix
···168169 nodePackages.prettier
169170 statix
170171171171- # Code coverage
172172- cargo-tarpaulin
173173-174172 # For running tests
175173 diffutils
174174+176175 # Official tools
177176 bzip2
178177 gnutar