From d0c2de9e762fb476b5cb53bb5129bf8af8cb9b45 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 May 2024 18:12:23 +0200 Subject: build: store default configuration in repo and ensure freshness --- nix/pre-commit-checks.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'nix/pre-commit-checks.nix') 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; + }; }; } -- cgit 1.4.1