cbz2pdf/nix/git-hooks.nix
Marc Plano-Lesay a0d01b9253
All checks were successful
Checking Renovate configuration / validate (pull_request) Successful in 1m46s
Build and test / Tests (pull_request) Successful in 7m34s
Build and test / Clippy (pull_request) Successful in 7m37s
Build and test / Build AMD64 (pull_request) Successful in 7m37s
Checking yaml / Run yamllint (pull_request) Successful in 4s
Build and test / Generate Documentation (pull_request) Successful in 6m41s
chore: migrate to Forgejo
2025-10-09 18:35:53 +11:00

65 lines
1.5 KiB
Nix

{ inputs, pkgs, ... }:
let
conventional-commit = pkgs.callPackage ./pkgs/conventional-pre-commit.nix { };
in
{
pre-commit-check = inputs.pre-commit-hooks.lib.${pkgs.system}.run {
src = ./..;
hooks = {
# TOML
check-toml.enable = true;
# YAML
check-yaml.enable = true;
# Nix
deadnix.enable = true;
flake-checker.enable = true;
nixpkgs-fmt.enable = true;
statix.enable = true;
# Rust
clippy = {
enable = true;
settings = {
denyWarnings = true;
};
extraPackages = with pkgs; [
openssl
pkg-config
];
};
rustfmt.enable = true;
cargo-check = {
enable = true;
extraPackages = with pkgs; [
pkg-config
openssl
];
};
# Git
no-commit-to-branch = {
enable = true;
settings = {
branch = [ "main" ];
};
};
conventional-commit = {
enable = true;
name = "conventional-commit";
description = "A pre-commit hook that checks commit messages for Conventional Commits formatting";
package = conventional-commit;
entry = "${conventional-commit}/bin/conventional-pre-commit";
args = [ "--strict" "feat" "fix" "chore" "revert" "style" "docs" "build" "refactor" "test" "ci" "perf" ];
stages = [ "commit-msg" ];
};
};
settings = {
rust.check.cargoDeps = pkgs.rustPlatform.importCargoLock {
lockFile = ../Cargo.lock;
};
};
};
}