diff options
author | EuAndreh <eu@euandre.org> | 2019-05-31 06:33:30 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2019-05-31 06:33:30 -0300 |
commit | bc196c376339a2a7ac6ce908003821e7fe7d82dc (patch) | |
tree | 4100708a5d18c47d4de6f94a836766906653e3d5 | |
parent | Format nixos/utils.nix (linter offense) (diff) | |
download | dotfiles-bc196c376339a2a7ac6ce908003821e7fe7d82dc.tar.gz dotfiles-bc196c376339a2a7ac6ce908003821e7fe7d82dc.tar.xz |
Add orgMkDocs derivation to utils.nix
-rw-r--r-- | default.nix | 10 | ||||
-rw-r--r-- | nixos/utils.nix | 16 |
2 files changed, 21 insertions, 5 deletions
diff --git a/default.nix b/default.nix index 36f689a..abc4694 100644 --- a/default.nix +++ b/default.nix @@ -2,6 +2,11 @@ let pkgs = import <nixpkgs> { }; rootSrc = pkgs.nix-gitignore.gitignoreSource [ ] ./.; in rec { + utils = import ./nixos/utils.nix { + pkgs = pkgs; + src = rootSrc; + baseName = "dotfiles"; + }; subtasks = rec { uniqueFeeds = utils.baseTask.overrideAttrs (baseAttrs: { name = "${baseAttrs.name}-unique-feeds"; @@ -23,11 +28,6 @@ in rec { ''; }); }; - utils = import ./nixos/utils.nix { - pkgs = pkgs; - src = rootSrc; - baseName = "dotfiles"; - }; test = utils.test [ utils.formatNix (utils.shellcheck ".*(encrypted|os-installation.sh|notmuch-post.sh).*") 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"; |