tvl-depot/web/tvl/default.nix
sterni c0e4b863c7 refactor(web/tvl): translate to markdown
This is mostly equivalent, but we need to accomodate cheddar a bit:

* cheddar doesn't like markdown inside of HTML, so the <main> tag
  around the image needs to go.

* cheddar messes with a top-level SVG for some reason, so we need to
  wrap it in a <div> in order to prevent that.

Change-Id: If9ed516623e81e24f600ee9f1b6d4d611b5bcedd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3117
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-09-15 12:55:45 +00:00

53 lines
1.3 KiB
Nix

{ depot, pkgs, ... }:
let
inherit (pkgs) graphviz runCommandNoCC writeText;
tvlGraph = runCommandNoCC "tvl.svg" {
nativeBuildInputs = with pkgs; [ fontconfig freetype cairo jetbrains-mono ];
} ''
${graphviz}/bin/neato -Tsvg ${./tvl.dot} > $out
'';
homepage = depot.web.tvl.template {
title = "The Virus Lounge";
content = ''
![The Virus Lounge](/static/virus_lounge.webp)
Welcome to **The Virus Lounge**. We're a random group of
people who feel undersocialised in these trying times, and
we've decided that there isn't enough spontaneous socialising
on the internet.
<hr>
## Where did all these people come from?
It's pretty straightforward. Feel free to click on people, too.
<div class="tvl-graph-container">
<!--
cheddar leaves HTML inside of HTML alone,
so wrapping the SVG prevents it from messing it up
-->
${builtins.readFile tvlGraph}
</div>
'';
extraHead = ''
<style>
.tvl-graph-container {
max-width: inherit;
}
.tvl-graph-container svg {
max-width: inherit;
height: auto;
}
</style>
'';
};
in runCommandNoCC "website" {} ''
mkdir $out
cp ${homepage} $out/index.html
cp -r ${depot.web.static} $out/static
''