From bc196c376339a2a7ac6ce908003821e7fe7d82dc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 31 May 2019 06:33:30 -0300 Subject: Add orgMkDocs derivation to utils.nix --- nixos/utils.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'nixos') diff --git a/nixos/utils.nix b/nixos/utils.nix index 502615e..e1a339a 100644 --- a/nixos/utils.nix +++ b/nixos/utils.nix @@ -58,6 +58,22 @@ in rec { exit 1 ''; }); + orgMkDocs = title: baseTask.overrideAttrs (baseAttrs: { + name = "${baseAttrs.name}-docs"; + buildInputs = [pkgs.pandoc pkgs.mkdocs]; + buildPhase = '' + # Convert from org-mode to markdown with pandoc + find docs/ -type f -name '*.org' -print0 | xargs -0 -I{} pandoc -o {}.md {}.org + + # Give the generated markdown files to MkDocs + mkdocs build + + # Build remaining one-off files + pandoc README.org -o site/index.html --css docs/README.css --to=html5 --self-contained --metadata title="${title}" + + mv site/ $out/ + ''; + }); test = testDerivations: baseTask.overrideAttrs (baseAttrs: { name = "${baseAttrs.name}-test"; -- cgit v1.2.3