build(nix): add formatting checks

Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
seth
2024-08-20 03:16:32 -04:00
parent 0ae421c265
commit e29ea4efb0
2 changed files with 59 additions and 4 deletions

42
nix/checks.nix Normal file
View File

@@ -0,0 +1,42 @@
{
runCommand,
deadnix,
llvmPackages_18,
markdownlint-cli,
nixfmt-rfc-style,
statix,
self,
}:
{
formatting =
runCommand "check-formatting"
{
nativeBuildInputs = [
deadnix
llvmPackages_18.clang-tools
markdownlint-cli
nixfmt-rfc-style
statix
];
}
''
cd ${self}
echo "Running clang-format...."
clang-format -i --style='file' --Werror */**.{c,cc,cpp,h,hh,hpp}
echo "Running deadnix..."
deadnix --fail
echo "Running markdownlint..."
markdownlint --dot .
echo "Running nixfmt..."
nixfmt --check .
echo "Running statix"
statix check .
touch $out
'';
}