diff --git a/flake.nix b/flake.nix index 5589e5a..031df52 100644 --- a/flake.nix +++ b/flake.nix @@ -20,11 +20,16 @@ url = "github:nlewo/comin"; inputs.nixpkgs.follows = "nixpkgs"; }; + + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs@{ self, nixpkgs, - flake-utils, sops-nix, utils, comin, + flake-utils, sops-nix, utils, comin, pre-commit-hooks, ... }: let @@ -33,6 +38,27 @@ utils.lib.mkFlake { inherit self inputs; + outputsBuilder = channels: let + pkgs = channels.nixpkgs; + system = pkgs.system; + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + nixfmt-rfc-style.enable = true; + statix.enable = true; + terraform-format.enable = true; + }; + }; + in { + checks = { + inherit pre-commit-check; + }; + devShells.default = pkgs.mkShell { + inherit (pre-commit-check) shellHook; + buildInputs = pre-commit-check.enabledPackages; + }; + }; + hostDefaults = { inherit system;