about summary refs log tree commit diff
path: root/checks.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--checks.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/checks.nix b/checks.nix
new file mode 100644
index 0000000..2d60a1c
--- /dev/null
+++ b/checks.nix
@@ -0,0 +1,40 @@
+{
+  system,
+  inputs,
+  lib,
+}: let
+  pkgs = inputs.self.legacyPackages.${system};
+in {
+  preCommit = inputs.pre-commit-hooks.lib.${system}.run {
+    src = builtins.path {
+      name = "nixfiles";
+      path = ./.;
+    };
+    hooks = {
+      alejandra.enable = true;
+      deadnix.enable = true;
+      editorconfig-checker.enable = true;
+      prettier = {
+        enable = true;
+        files = "\\.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)$";
+      };
+    };
+    settings.deadnix.edit = true;
+  };
+}

Consider giving Nix/NixOS a try! <3