A file of its own reads as a script, says what its output looks like and is checked by a new `shellcheck` lint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
1.1 KiB
Nix
46 lines
1.1 KiB
Nix
# Checks that the crate is free of clippy warnings and formatted with rustfmt, and its shell scripts
|
|
# pass shellcheck, as CI requires
|
|
{ pkgs, slop-broker }:
|
|
let
|
|
inherit (pkgs.lib.fileset) toSource unions;
|
|
in
|
|
{
|
|
clippy = slop-broker.overrideAttrs (old: {
|
|
pname = "slop-broker-clippy";
|
|
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.clippy ];
|
|
buildPhase = ''
|
|
cargo clippy --offline --all-targets -- -D warnings
|
|
'';
|
|
doCheck = false;
|
|
installPhase = ''
|
|
touch $out
|
|
'';
|
|
});
|
|
|
|
shellcheck = pkgs.runCommand "slop-broker-shellcheck"
|
|
{
|
|
nativeBuildInputs = [ pkgs.shellcheck ];
|
|
src = toSource {
|
|
root = ../.;
|
|
fileset = pkgs.lib.fileset.fileFilter (file: file.hasExt "sh") ../src;
|
|
};
|
|
} ''
|
|
cd $src
|
|
shellcheck $(find . -name '*.sh')
|
|
touch $out
|
|
'';
|
|
|
|
fmt = pkgs.runCommand "slop-broker-fmt"
|
|
{
|
|
nativeBuildInputs = with pkgs; [ cargo rustfmt ];
|
|
src = toSource {
|
|
root = ../.;
|
|
fileset = unions [ ../Cargo.toml ../Cargo.lock ../rustfmt.toml ../src ../tests ];
|
|
};
|
|
} ''
|
|
cd $src
|
|
cargo fmt --check
|
|
touch $out
|
|
'';
|
|
}
|