about summary refs log tree commit diff
path: root/web/tvl/default.nix
blob: 2a471fadc3252c1f384aa8eb1c332b32466f09b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ 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
''