mfgames-project-setup-flake/src/configs/lefthook.nix

22 lines
588 B
Nix

inputs @ { system, pkgs, nixago, nixago-exts, ... }:
nixago-exts.lefthook.${system} {
commit-msg = {
commands = {
# Runs conform on commit-msg hook to ensure commit messages are
# compliant.
conform = {
run = "${pkgs.conform}/bin/conform enforce --commit-msg-file {1}";
};
};
};
pre-commit = {
commands = {
# Runs treefmt on pre-commit hook to ensure checked-in source code is
# properly formatted.
treefmt = {
run = "${pkgs.treefmt}/bin/treefmt {staged_files} && git add {staged_files}";
};
};
};
}