add pre-commit hooks
1 file changed, 15 insertions(+), 0 deletions(-)
changed files
M flake.nix → flake.nix
@@ -25,6 +25,7 @@ nixvim = { url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; }; + pre-commit-hooks.url = "github:cachix/git-hooks.nix"; treefmt-nix.url = "github:numtide/treefmt-nix"; golink = { url = "github:tailscale/golink";@@ -195,6 +196,9 @@ in { devShells = { default = pkgs.mkShell { + inherit (self.checks.${system}.pre-commit-check) shellHook; + buildInputs = self.checks.${system}.pre-commit-check.enabledPackages; + packages = with pkgs; [ nixos-rebuild agenix.packages.${system}.default@@ -202,6 +206,17 @@ ]; }; }; formatter = treefmtEval.config.build.wrapper; + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + check-executables-have-shebangs.enable = true; + check-shebang-scripts-are-executable.enable = true; + check-symlinks.enable = true; + reuse.enable = true; + }; + }; + }; } ); }