about summary refs log tree commit diff stats
path: root/nix/pre-commit-checks.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix/pre-commit-checks.nix')
-rw-r--r--nix/pre-commit-checks.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/nix/pre-commit-checks.nix b/nix/pre-commit-checks.nix
index bd6df7c..4858783 100644
--- a/nix/pre-commit-checks.nix
+++ b/nix/pre-commit-checks.nix
@@ -91,5 +91,19 @@ rec {
       entry = "${pkgs.gomod2nix}/bin/gomod2nix";
       pass_filenames = false;
     };
+
+    generate-default-config = {
+      enable = true;
+      name = "generate-default-config";
+      description = "Ensure default configuration file is up-to-date";
+      files = "config.go$";
+      entry =
+        let
+          script = pkgs.writeShellScript "generate-default-config" ''
+            ${pkgs.wgo}/bin/wgo run -exit searchix.go --print-default-config > defaults.toml
+          '';
+        in
+        builtins.toString script;
+    };
   };
 }