diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix index 3645b8b..a8ab81d 100644 --- a/nix/pkgs/default.nix +++ b/nix/pkgs/default.nix @@ -103,10 +103,14 @@ let vlan-report = import ./vlan-report.nix { inherit self nixpkgs system; }; + + homepage = pkgs.callPackage ./homepage { + inherit self; + }; in rootfs-packages // vm-packages // device-templates // openwrt-packages // network-graphs // network-cypher-graphs // starlink // subnetplans // { inherit export-openwrt-models export-config dns-slaves encrypt-secrets decrypt-secrets switch-to-production - vlan-report + homepage vlan-report ; } diff --git a/nix/pkgs/homepage/default.nix b/nix/pkgs/homepage/default.nix new file mode 100644 index 000000000..906a424 --- /dev/null +++ b/nix/pkgs/homepage/default.nix @@ -0,0 +1,52 @@ +{ 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/ + ''; +} diff --git a/nix/pkgs/homepage/figure.html b/nix/pkgs/homepage/figure.html new file mode 100644 index 000000000..5e490c2 --- /dev/null +++ b/nix/pkgs/homepage/figure.html @@ -0,0 +1,4 @@ +
+ @caption@ +
@caption@
+
diff --git a/nix/pkgs/homepage/footer.html b/nix/pkgs/homepage/footer.html new file mode 100644 index 000000000..bccce69 --- /dev/null +++ b/nix/pkgs/homepage/footer.html @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/nix/pkgs/homepage/header.html b/nix/pkgs/homepage/header.html new file mode 100644 index 000000000..195abec --- /dev/null +++ b/nix/pkgs/homepage/header.html @@ -0,0 +1,31 @@ + + + + zentralwerk.org + + + + + + + + + + + + +
+

zentralwerk-network

+ +
+ +
diff --git a/nix/pkgs/homepage/src/background.svg b/nix/pkgs/homepage/src/background.svg new file mode 100644 index 000000000..35ba299 --- /dev/null +++ b/nix/pkgs/homepage/src/background.svg @@ -0,0 +1,61 @@ + + + + + + + + + + diff --git a/nix/pkgs/homepage/src/style.css b/nix/pkgs/homepage/src/style.css new file mode 100644 index 000000000..7ee362c --- /dev/null +++ b/nix/pkgs/homepage/src/style.css @@ -0,0 +1,78 @@ +body { + margin: 0; + padding: 0; + background: #AF1F00 url('background.svg') fixed no-repeat center/100%; + color: #FFEF00; + font-family: sans-serif; + display: flex; + flex-direction: column; + justify-content: space-between; + min-height: 100vh; +} + +a { + text-decoration: none; + font-weight: bold; + color: #CF3F1F; +} + +a:visited { + color: #AF1F00; +} + +header, footer { + background-color: #FFEF00; + color: #AF1F00; + text-align: center; +} +header { + margin: 0 0 3rem; + border-bottom: 1rem solid #DFCF00; +} +header h1 { + margin: 0.5rem 0; + padding: 0rem 2rem; + font-family: serif; +} +footer { + margin: 3rem 0 0; +} +footer p { + margin: 0.3rem 0; +} +nav ul { + margin: 0.3rem 0; + padding: 0; + list-style-type: none; +} +nav ul li { + display: inline-block; + margin: 0 2rem; + padding: 0; +} + +main { + min-width: 50vh; + max-width: 60rem; + margin: 1rem auto; + padding: 1.5rem 4rem; + background: #FFF; + color: #111; + border-top: 1rem solid #EFDF00; + border-left: 1rem solid #EFDF00; + border-right: 1.5rem solid #DFCF00; + border-bottom: 1.5rem solid #DFCF00; + overflow: auto; +} + +main figure { + text-align: center; +} + +main figure img { + max-width: 100%; +} + +main table { + font-size: 75%; +} diff --git a/nix/pkgs/homepage/src/zw.png b/nix/pkgs/homepage/src/zw.png new file mode 100644 index 000000000..c02efe7 Binary files /dev/null and b/nix/pkgs/homepage/src/zw.png differ diff --git a/nix/pkgs/vlan-report.nix b/nix/pkgs/vlan-report.nix index 764719d..6749d59 100644 --- a/nix/pkgs/vlan-report.nix +++ b/nix/pkgs/vlan-report.nix @@ -3,8 +3,10 @@ with nixpkgs.legacyPackages.${system}; let config = self.lib.config; in -writeText "vlan-report.txt" ( - lib.concatMapStrings (net: '' +writeText "vlan-report.md" '' + # VLAN Report + + ${lib.concatMapStrings (net: '' ## ${net}${lib.optionalString (config.site.net.${net}.vlan != null) " (VLAN ${toString config.site.net.${net}.vlan})"} ${lib.concatStringsSep "\n" ( lib.concatMap (host: @@ -18,5 +20,5 @@ writeText "vlan-report.txt" ( ) (lib.attrNames config.site.hosts) )} - '') (lib.attrNames config.site.net) -) + '') (lib.attrNames config.site.net)} +''