flake.nix: Add pre-commit-hooks-nix
Description of changes
Introduces pre-commit-hook-nix to the flake which automatically runs various checks before committing and fixes all the problems reported by said checks. The default devShell was extended to install the pre-commit git hook. Furthermore it modifies the CI configuration to run all the checks from pre-commit, including the formatter (which was not changed, just integrated into pre-commit).
To install the hook, it is sufficient to open the flake's default devShell (even if to close it immediately after). However, if the devShell is not used for development, developers risk pre-commit
being garbage collected out of the Nix store, breaking git commit
.
direnv
is a good option to mitigate this issue: I personally use it with nix-direnv, with options to override inputs with my system's nixpkgs (use flake . --override-input nixpkgs flake:nixpkgs --override-input unstable flake:unstable
).
Things done
-
Tested - but not with a full
nix flake check
- but not with a full
-
Updated documentation (Wiki/NetBox) -
Breaking change