diff --git a/.gitignore b/.gitignore index 8edff63..a95793c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /.direnv +/mutants.out +/mutants.out.old /result /result-* /target diff --git a/nix/checks.nix b/nix/checks.nix index fd340f9..470b0b9 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -38,6 +38,25 @@ } ); + mkMutants = + suffix: features: + toolchains.nightly.mkCargoDerivation ( + commonArgs + // { + cargoArtifacts = cargoArtifactsDev; + CARGO_PROFILE = "dev"; + pnameSuffix = "-mutants${suffix}"; + nativeBuildInputs = [ + pkgs.cargo-mutants + pkgs.cargo-nextest + ]; + buildPhaseCargoCommand = '' + cargo mutants --in-place --test-tool nextest --no-default-features --features ${features} + ''; + installPhase = "mkdir -p $out"; + } + ); + testChecks = pkgs.lib.concatMapAttrs ( tcName: craneLib: pkgs.lib.mapAttrs' ( @@ -71,6 +90,9 @@ } ); + mutants-unit = mkMutants "-unit" "unit-tests"; + mutants-prop = mkMutants "-prop" "prop-tests"; + clippy = toolchains.nightly.cargoClippy ( checkArgs // { @@ -143,7 +165,19 @@ }; nightly = pkgs.symlinkJoin { name = "nightly-checks-${rev}"; - paths = builtins.attrValues checks; + paths = builtins.attrValues ( + removeAttrs checks [ + "mutants-unit" + "mutants-prop" + ] + ); + }; + mutants = pkgs.symlinkJoin { + name = "mutants-checks"; + paths = [ + checks.mutants-unit + checks.mutants-prop + ]; }; }; };