diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix index c043444..e36b4ed 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,17 @@ # We want home-manager to use the same set of nixpkgs as our system. inputs.nixpkgs.follows = "nixpkgs"; }; + + pre-commit-hooks = { + type = "github"; + owner = "cachix"; + repo = "pre-commit-hooks.nix"; + ref = "master"; + inputs = { + flake-utils.follows = "futils"; + nixpkgs.follows = "nixpkgs"; + }; + }; }; # Output config, or config for NixOS system @@ -57,6 +68,22 @@ }; }; + checks = { + pre-commit = inputs.pre-commit-hooks.lib.${system}.run { + src = ./.; + + hooks = { + nixpkgs-fmt = { + enable = true; + }; + + shellcheck = { + enable = true; + }; + }; + }; + }; + # `nix run .#ci.format` formats in current directory! apps.ci.format = ci.fmt.mkFmtScript self; @@ -67,6 +94,7 @@ default = pkgs.mkShell { name = "NixOS-config"; buildInputs = with pkgs; [ + gitAndTools.pre-commit nixUnstable nixfmt nixpkgs-fmt @@ -76,6 +104,7 @@ go gopls ]; + inherit (self.checks.${system}.pre-commit) shellHook; }; }; }) // { |