about summary refs log tree commit diff
path: root/checks.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-11-13 10:40:41 +0300
committerAzat Bahawi <azat@bahawi.net>2023-11-13 10:40:41 +0300
commita3f9fde2a2d43dd477f402bd4b8df2a1cd29ca43 (patch)
treecbd0c2457daa6865eb33b5389ec40309e60868a9 /checks.nix
parent2023-11-12 (diff)
2023-11-13
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