From e8afe153a078db31111a0073786b860945b375c0 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Giraudeau Date: Fri, 4 Sep 2020 15:53:45 +0200 Subject: [PATCH] Release docs pdf on hydra --- default.nix | 2 +- docs/network-spec/Makefile | 8 +++--- docs/shell.nix | 1 + nix/docs.nix | 57 ++++++++++++++++++++++++++++++++++++++ nix/pkgs.nix | 2 ++ 5 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 docs/shell.nix create mode 100644 nix/docs.nix diff --git a/default.nix b/default.nix index 4248e433a10..f9cc6f0c50b 100644 --- a/default.nix +++ b/default.nix @@ -27,7 +27,7 @@ let }; self = { - inherit haskellPackages; + inherit haskellPackages docs; inherit (haskellPackages.ouroboros-network.identifier) version; diff --git a/docs/network-spec/Makefile b/docs/network-spec/Makefile index ffa65f1e99e..df0455a9e76 100644 --- a/docs/network-spec/Makefile +++ b/docs/network-spec/Makefile @@ -33,11 +33,11 @@ all: $(DOCNAME).pdf # -interaction=nonstopmode keeps the pdflatex backend from stopping at a # missing file reference and interactively asking you for an alternative. -$(DOCNAME).pdf: $(DOCNAME).tex messages.cddl - latexmk -pdf -pdflatex="pdflatex -synctex=1 -interaction=nonstopmode" -use-make $(DOCNAME).tex +$(DOCNAME).pdf: $(DOCNAME).tex ../../ouroboros-network/test/messages.cddl + latexmk -bibtex -pdf -pdflatex="pdflatex -synctex=1 -interaction=nonstopmode" -use-make $(DOCNAME).tex -watch: network.tex miniprotocols.tex messages.cddl - latexmk -pvc -pdf -pdflatex="pdflatex -synctex=1 -interaction=nonstopmode" -use-make $(DOCNAME).tex +watch: network.tex miniprotocols.tex ../../ouroboros-network/test/messages.cddl + latexmk -bibtex -pvc -pdf -pdflatex="pdflatex -synctex=1 -interaction=nonstopmode" -use-make $(DOCNAME).tex clean: latexmk -CA diff --git a/docs/shell.nix b/docs/shell.nix new file mode 100644 index 00000000000..63662011a6b --- /dev/null +++ b/docs/shell.nix @@ -0,0 +1 @@ +(import ../nix {}).docs diff --git a/nix/docs.nix b/nix/docs.nix new file mode 100644 index 00000000000..8f1127b8d7a --- /dev/null +++ b/nix/docs.nix @@ -0,0 +1,57 @@ +{ pkgs }: with pkgs; +let + src = haskell-nix.haskellLib.cleanGit { + name = "ouroboros-network-docs-src"; + src = ../.; + subDir = "docs"; + }; + message-cddl = ../ouroboros-network/test/messages.cddl; +in pkgs.runCommand "ouroboros-network-docs" { + nativeBuildInputs = [ imagemagick ]; + buildInputs = [ (texlive.combine { + inherit (texlive) + cleveref + framed + scheme-small + collection-fontsrecommended + stmaryrd kpfonts geometry hyperref + todonotes + amsmath mathtools + colortbl polytable lazylist + fancyvrb + #graphicx + pstricks + wrapfig + # build tools + latexmk + ; + })]; +} '' + for d in network-design network-spec; do + mkdir -p docs/$d + ln -s ${src}/$d/* docs/$d/ + done + + mkdir -p ouroboros-network/test + cp ${message-cddl} ouroboros-network/test/messages.cddl + + mkdir -p $out + + ( + cd docs/network-design + latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" + cp -a *.pdf $out/ + ) + + ( + cd docs/network-spec + make all + cp -a *.pdf $out/ + ) + + mkdir -p $out/nix-support + + for pdf in $out/*.pdf; do + echo "file binary-dist $pdf" >> $out/nix-support/hydra-build-products + done +'' diff --git a/nix/pkgs.nix b/nix/pkgs.nix index c9f97a18d40..910c0762203 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -9,4 +9,6 @@ pkgs: _: with pkgs; { buildPackages ; }; + + docs = callPackages ./docs.nix {}; }