Skip to content

Commit df1fdeb

Browse files
committed
Add promtool-rules hook
1 parent c06f90f commit df1fdeb

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

modules/hooks.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,12 @@ in
14951495
};
14961496
};
14971497
};
1498+
promtool-rules = mkOption {
1499+
description = "promtool-rules hook";
1500+
type = types.submodule {
1501+
imports = [ hookModule ];
1502+
};
1503+
};
14981504
psalm = mkOption {
14991505
description = "psalm hook";
15001506
type = types.submodule {
@@ -3929,6 +3935,14 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
39293935
in
39303936
"${hooks.proselint.package}/bin/proselint${cmdArgs} ${hooks.proselint.settings.flags}";
39313937
};
3938+
promtool-rules =
3939+
{
3940+
name = "promtool-rules";
3941+
description = "Validate Prometheus recording and alerting rules.";
3942+
package = tools.promtool;
3943+
entry = "${hooks.promtool-rules.package}/bin/promtool check rules";
3944+
types = [ "yaml" ];
3945+
};
39323946
psalm =
39333947
{
39343948
name = "psalm";

nix/tools.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
, poetry
7373
, pre-commit-hook-ensure-sops ? placeholder "pre-commit-hook-ensure-sops"
7474
, prettier
75+
, prometheus
7576
, proselint
7677
, python3Packages
7778
, pyright ? nodePackages.pyright
@@ -275,6 +276,7 @@ in
275276
bats;
276277

277278
headache = callPackage ./headache { };
279+
promtool = prometheus.cli;
278280

279281
# Disable tests as these take way to long on our infra.
280282
julia-bin = julia-bin.overrideAttrs (_: _: { doInstallCheck = false; });

0 commit comments

Comments
 (0)