flake clippy: override build phase to bypass naersk mode

This commit is contained in:
müde 2026-05-14 23:01:13 +02:00
parent ad9e60dad3
commit cf4c84d7c9

View file

@ -126,24 +126,38 @@
checks = forAllSystems ( checks = forAllSystems (
{ {
treefmt-eval, treefmt-eval,
pkgs,
naersk-lib, naersk-lib,
... ...
}: }:
{ {
formatting = treefmt-eval.config.build.check self; formatting = treefmt-eval.config.build.check self;
clippy = naersk-lib.buildPackage { # Clippy as a check: reuse naersk's vendored-deps environment but
src = ./.; # replace the build phase with `cargo clippy --workspace --all-targets
mode = "clippy"; # -- -D warnings`. Naersk's own `mode = "clippy"` mangles the `--`
cargoBuildOptions = # separator, so we go through overrideAttrs instead.
orig: clippy =
orig (naersk-lib.buildPackage {
++ [ src = ./.;
"--workspace" # Skip the actual build; we only care about the clippy lint.
"--" doCheck = false;
"-D" copyTarget = false;
"warnings" }).overrideAttrs
]; (old: {
}; pname = "${old.pname}-clippy";
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.clippy ];
buildPhase = ''
runHook preBuild
cargo clippy --workspace --all-targets -- -D warnings
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
touch $out/.clippy-passed
runHook postInstall
'';
});
} }
); );
}; };