diff options
Diffstat (limited to '')
-rw-r--r-- | utils.nix | 24 |
1 files changed, 10 insertions, 14 deletions
@@ -61,21 +61,16 @@ in rec { exit 1 ''; }); - orgMkDocs = title: + readmeCss = builtins.fetchurl { + url = "https://euandre.org/dotfiles/static/README.css"; + sha256 = "1r7ak92zsbhjm1qxz0r3dig0yxb41l43zl0yai63izha2s5r54d4"; + }; + readmeOrg = title: baseTask.overrideAttrs (baseAttrs: { - name = "${baseAttrs.name}-docs"; - buildInputs = [ pkgs.pandoc pkgs.mkdocs ]; + name = "${baseAttrs.name}-readme-docs"; + buildInputs = [ pkgs.pandoc ]; 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/ + pandoc README.org -o $out --css ${readmeCss} --to=html5 --self-contained --metadata title="${title}" ''; }); test = testDerivations: @@ -90,10 +85,11 @@ in rec { touch $out ''; }); - publishScript = docsDerivation: + overwritingPublishScript = { docsDerivation, overwrite ? true }: pkgs.writeShellScriptBin "publish.sh" '' set -euo pipefail OUT_DOCS="${docsDerivation}" + ${if overwrite then "# " else ""}${pkgs.openssh}/bin/ssh -o StrictHostKeyChecking=no "$SERVER_URL" rm -rf "$DOCS_SERVER_PATH/*" ${pkgs.rsync}/bin/rsync -avzP \ --rsh="ssh -o StrictHostKeyChecking=no" \ "$OUT_DOCS/" \ |