Skip to content
Permalink
Browse files

apply specialisation in doc/default.nix

  • Loading branch information...
MarcFontaine committed Jun 16, 2019
1 parent 1a45082 commit c8c53756735593126d53fee433a1df8e33059346
Showing with 26 additions and 23 deletions.
  1. +3 −3 default.nix
  2. +23 −20 doc/default.nix
@@ -49,10 +49,10 @@ let
inherit customConfig;
};
tests = import ./nix/nixos/tests { inherit (commonLib) pkgs; };
network-pdf-wip = import ./doc/default.nix {inherit commonLib; isRelease=false; };
network-pdf = import ./doc/default.nix {inherit commonLib; isRelease=true; };
documents = import ./doc/default.nix {inherit commonLib; };
in {
inherit scripts tests;
inherit (nixTools) nix-tools;
inherit network-pdf network-pdf-wip;
network-pdf-wip = documents.network-pdf-wip;
network-pdf = documents.network-pdf;
}
@@ -3,7 +3,6 @@
pkgs ? commonLib.pkgs,
stdenv ? pkgs.stdenv,
texlive ? pkgs.texlive,
isRelease ? false
}:

let
@@ -23,24 +22,28 @@ let
bibtex biblatex
latexmk;
};
document = isRelease: stdenv.mkDerivation {
name = if isRelease then "network-pdf" else "network-pdf-wip";
buildInputs = [ tex pkgs.cddl ];
# this is a hack :
# network.tex includes ../ouroboros-network/test/messages.cddl .
# Therefor the src also includes the parrent directory.
src = pkgs.lib.sourceFilesBySuffices ../. [ ".tex" ".bib" ".pdf" ".cddl"];
buildPhase = ''
# run cddl to catch syntax errors in messages.cddl
cddl ouroboros-network/test/messages.cddl generate 1
cd doc
${if isRelease then "echo >.isRelease" else "rm -f .isRelease"}
latexmk -view=pdf network;
'';
installPhase = ''
install -Dt $out network.pdf
mkdir $out/nix-support
echo "doc-pdf network $out/network.pdf" >> $out/nix-support/hydra-build-products
'';
};
in
stdenv.mkDerivation {
name = if isRelease then "network-pdf" else "network-pdf-wip";
buildInputs = [ tex pkgs.cddl ];
# this is a hack :
# network.tex includes ../ouroboros-network/test/messages.cddl .
# Therefor the src also includes the parrent directory.
src = pkgs.lib.sourceFilesBySuffices ../. [ ".tex" ".bib" ".pdf" ".cddl"];
buildPhase = ''
# run cddl to catch syntax errors in messages.cddl
cddl ouroboros-network/test/messages.cddl generate 1
cd doc
${if isRelease then "echo >.isRelease" else "rm -f .isRelease"}
latexmk -view=pdf network;
'';
installPhase = ''
install -Dt $out network.pdf
mkdir $out/nix-support
echo "doc-pdf network $out/network.pdf" >> $out/nix-support/hydra-build-products
'';
{
network-pdf = document true;
network-pdf-wip = document false;
}

0 comments on commit c8c5375

Please sign in to comment.
You can’t perform that action at this time.