chore: improve Nix flake
This commit is contained in:
parent
e9231986c3
commit
7836888456
6 changed files with 208 additions and 20 deletions
65
nix/git-hooks.nix
Normal file
65
nix/git-hooks.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{ 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue