dream2nix/modules/flake-parts/pre-commit-check.nix

36 lines
737 B
Nix
Raw Normal View History

{
self,
lib,
inputs,
...
}: {
perSystem = {
config,
self',
inputs',
pkgs,
...
}: {
checks = {
pre-commit-check = inputs.pre-commit-hooks.lib.${pkgs.system}.run {
src = ../../.;
hooks = {
treefmt = {
enable = true;
name = "treefmt";
pass_filenames = false;
entry = toString (pkgs.writeScript "treefmt" ''
#!${pkgs.bash}/bin/bash
export PATH="$PATH:${lib.makeBinPath [
pkgs.alejandra
pkgs.python3.pkgs.black
]}"
${pkgs.treefmt}/bin/treefmt --clear-cache --fail-on-change
'');
};
};
};
};
};
}