From dd3cd5048c13ba5bef5a76444d1b95c3fef91371 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 10 Nov 2021 16:06:31 +0100 Subject: mdbook: add preBuild and postBuild hooks --- mdbook.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mdbook.nix b/mdbook.nix index d336042..9c2dd66 100644 --- a/mdbook.nix +++ b/mdbook.nix @@ -17,6 +17,24 @@ in ''; internal = optionsInternal; }; + + preBuild = mkOption { + type = types.lines; + description = '' + Extra commands executed before running `mdbook build`. + ''; + default = ""; + internal = optionsInternal; + }; + + postBuild = mkOption { + type = types.lines; + description = '' + Extra commands executed after running `mdbook build`. + ''; + default = ""; + internal = optionsInternal; + }; }; }; @@ -37,8 +55,12 @@ in cp "${getAttrFromPath (outputAttrPath ++ ["doc-options-md"]) config}" src/options.md + ${cfg.preBuild} + mdbook build + ${cfg.postBuild} + cp -r book "$out" ''; }; -- cgit v1.2.3