network/nix/pkgs/homepage/default.nix

53 lines
1.1 KiB
Nix

{ self
, system
, substituteAll
, stdenv
, pandoc
}:
let
inherit (self.packages.${system}) network-graphs subnetplans vlan-report;
in
stdenv.mkDerivation {
pname = "zentralwerk-network-homepage";
version = self.lastModifiedDate;
src = ./src;
nativeBuildInputs = [
pandoc
];
buildPhase = ''
pandoc -t html ${../../../doc/hello.md} > index.html
pandoc -t html ${vlan-report} > vlan-report.html
ln -s ${substituteAll {
src = ./figure.html;
img = "physical.png";
caption = "Physikalische Netzwerkstruktur";
}} physical.html
ln -s ${substituteAll {
src = ./figure.html;
img = "logical.png";
caption = "Logische Netzwerkstruktur";
}} logical.html
ln -s ${subnetplans}/share/doc/zentralwerk/* .
for F in *.html; do
cat ${./header.html} "$F" ${./footer.html} > "$F.new"
rm "$F"
mv "$F.new" "$F"
done
'';
installPhase = ''
DIR=$out/share/doc/zentralwerk/www
mkdir -p $DIR
ln -s ${network-graphs}/share/doc/zentralwerk/* $DIR/
ln -s ${../../../doc/core.png} $DIR/core.png
cp *.{html,css,png,svg} $DIR/
'';
}