feat: add pre-commit-hooks

This commit is contained in:
Luj 2024-04-07 14:33:13 +02:00
parent b7f553f3ec
commit ec1fa9b3b8
Signed by: luj
GPG key ID: 6FC74C847011FD83
3 changed files with 56 additions and 5 deletions

View file

@ -1,12 +1,35 @@
let
inputs = import ./deps;
pkgs = import inputs.nixpkgs { };
pkgs = import inputs.unstable { };
nixos-anywhere = pkgs.callPackage "${inputs.nixos-anywhere}/src/default.nix" { };
agenix = pkgs.callPackage "${inputs.agenix}/pkgs/agenix.nix" { };
bootstrap = import scripts/bootstrap-machine.nix;
pre-commit-hook = (import inputs.git-hooks).run {
src = ./.;
hooks = {
statix.enable = true;
deadnix.enable = true;
rfc101 = {
enable = true;
name = "RFC-101 formatting";
entry = "${pkgs.lib.getExe pkgs.nixfmt-rfc-style}";
files = "\\.nix$";
};
commitizen.enable = true;
};
};
in
pkgs.mkShell {
nativeBuildInputs = with pkgs; [ colmena npins nixos-anywhere agenix bootstrap ];
nativeBuildInputs = with pkgs; [
colmena
npins
nixos-anywhere
agenix
bootstrap
statix
];
shellHook = ''
${pre-commit-hook.shellHook}
'';
}