summaryrefslogtreecommitdiff
path: root/checks.nix
blob: f9949e3ea9a0cf3a7db1a68dbcf4dc643bb1b355 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ inputs, system }:
with inputs.nixpkgs.lib;
let
  pkgs = inputs.self.legacyPackages.${system};
in
{
  preCommit = inputs.pre-commit.lib.${system}.run {
    src = builtins.path {
      name = "nixfiles";
      path = ./.;
    };
    hooks = {
      nixfmt = {
        enable = true;
        package = pkgs.nixfmt;
      };
      deadnix = {
        enable = true;
        settings.edit = true;
      };
      editorconfig-checker.enable = true;
      prettier = {
        enable = true;
        types_or = mkForce [ "css" ];
      };
      shellcheck.enable = true;
      shfmt.enable = true;
      statix.enable = true;
      typos = {
        enable = true;
        types = [ "text" ];
        pass_filenames = false;
      };
      yamllint.enable = true;
      promtool = {
        enable = true;
        name = "promtool";
        description = "Check Prometheus rules";
        entry = "${pkgs.prometheus.cli}/bin/promtool check rules";
        files = "(?x)^(modules/nixos/monitoring/rules/.*\.yaml)$";
      };
    };
  };
}