flake clippy: override build phase to bypass naersk mode
This commit is contained in:
parent
ad9e60dad3
commit
cf4c84d7c9
1 changed files with 27 additions and 13 deletions
38
flake.nix
38
flake.nix
|
|
@ -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
|
||||||
|
# replace the build phase with `cargo clippy --workspace --all-targets
|
||||||
|
# -- -D warnings`. Naersk's own `mode = "clippy"` mangles the `--`
|
||||||
|
# separator, so we go through overrideAttrs instead.
|
||||||
|
clippy =
|
||||||
|
(naersk-lib.buildPackage {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
mode = "clippy";
|
# Skip the actual build; we only care about the clippy lint.
|
||||||
cargoBuildOptions =
|
doCheck = false;
|
||||||
orig:
|
copyTarget = false;
|
||||||
orig
|
}).overrideAttrs
|
||||||
++ [
|
(old: {
|
||||||
"--workspace"
|
pname = "${old.pname}-clippy";
|
||||||
"--"
|
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.clippy ];
|
||||||
"-D"
|
buildPhase = ''
|
||||||
"warnings"
|
runHook preBuild
|
||||||
];
|
cargo clippy --workspace --all-targets -- -D warnings
|
||||||
};
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
mkdir -p $out
|
||||||
|
touch $out/.clippy-passed
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue