From 7a3e7af2cc06dd7788ef90ecad8a3075bf51cd6b Mon Sep 17 00:00:00 2001 From: waalge Date: Sat, 14 Jan 2023 11:39:56 +0000 Subject: [PATCH] add pre-commit hook for book --- flake.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/flake.nix b/flake.nix index d93ef6d4..6e1d58b2 100644 --- a/flake.nix +++ b/flake.nix @@ -299,6 +299,17 @@ fi ''); }; + build-docs = { + enable = true; + name = "build-docs"; + entry = l.toString (pkgs.writeScript "build-docs" '' + #!${pkgs.bash}/bin/bash + errors=$(mdbook build docs/ 2>&1 | grep ERROR) # no better way?! + if [ $errors ]; then + exit 1 + fi + ''); + }; }; }; };