flake: Add typo checker pass to check phase

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2023-08-12 13:13:02 +02:00
parent 15a0aae7c6
commit a5529e0acd
Signed by: c8h4
GPG key ID: 9C82009BEEDEA0FF

View file

@ -31,6 +31,25 @@
rustToolchain = pkgs.rust-bin.stable."1.71.0".default;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
cargoTypos = args:
craneLib.mkCargoDerivation (args // {
cargoArtifacts = null;
cargoVendorDir = null;
buildPhaseCargoCommand = "typos";
pnameSuffix = "-typos";
nativeBuildInputs = (args.nativeBuildInputs or [ ])
++ (with pkgs; [ typos ]);
preInstallPhases = [ "ensureTargetDir" ]
++ (args.preInstallPhases or [ ]);
ensureTargetDir = ''
mkdir -p ''${CARGO_TARGET_DIR:-target}
'';
});
shouldRunCoverage = system == "x86_64-linux"
&& ((builtins.getEnv "CI") != "");
@ -48,6 +67,7 @@
srht-buildtest-doc =
craneLib.cargoDoc { inherit src cargoArtifacts; };
srht-buildtest-fmt = craneLib.cargoFmt { inherit src; };
srht-buildtest-typos = cargoTypos { inherit src; };
} // lib.optionalAttrs shouldRunCoverage {
srht-buildtest-coverage =
craneLib.cargoTarpaulin { inherit src cargoArtifacts; };