flake: Add typo checker pass to check phase
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
parent
15a0aae7c6
commit
a5529e0acd
20
flake.nix
20
flake.nix
|
@ -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; };
|
||||
|
|
Loading…
Reference in a new issue