about summary refs log tree commit diff
path: root/web/tvl/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'web/tvl/default.nix')
-rw-r--r--web/tvl/default.nix189
1 files changed, 128 insertions, 61 deletions
diff --git a/web/tvl/default.nix b/web/tvl/default.nix
index 552940cb51..8bbc7d566a 100644
--- a/web/tvl/default.nix
+++ b/web/tvl/default.nix
@@ -1,74 +1,141 @@
-{ depot, pkgs, ... }:
+{ depot, lib, pkgs, ... }:
+
+with depot.nix.yants;
 
 let
-  inherit (pkgs) graphviz runCommandNoCC writeText;
+  inherit (builtins) filter;
+  inherit (pkgs) graphviz runCommand writeText;
+  inherit (depot.web) atom-feed blog tvl;
+
+  listPosts = defun [ (list blog.post) string ] (posts:
+    lib.concatStringsSep "\n" (map (p: "* [${p.title}](blog/${p.key})") posts)
+  );
+
+  postRenderingCommands = defun [ (list blog.post) string ] (posts:
+    lib.concatStringsSep "\n"
+      (map (p: "cp ${blog.renderPost tvl.blog.config p} $out/blog/${p.key}.html") posts)
+  );
 
-  tvlGraph = runCommandNoCC "tvl.svg" {
-    nativeBuildInputs = with pkgs; [ fontconfig freetype cairo jetbrains-mono ];
-  } ''
+  tvlGraph = runCommand "tvl.svg"
+    {
+      nativeBuildInputs = with pkgs; [ fontconfig freetype cairo jetbrains-mono ];
+    } ''
     ${graphviz}/bin/neato -Tsvg ${./tvl.dot} > $out
   '';
 
-  homepage = writeText "index.html" ''
-    <!DOCTYPE html>
-    <head>
-      <meta charset="utf-8">
-      <meta name="viewport" content="width=device-width, initial-scale=1">
-      <meta name="description" content="tazjin's Virus Lounge">
-      <link rel="stylesheet" type="text/css" href="/static/tazjin.css" media="all">
-      <link rel="icon" type="image/webp" href="/static/favicon.webp">
-      <title>tazjin's Virus Lounge</title>
+  publishedPosts = filter blog.includePost tvl.blog.posts;
+
+  feed = {
+    id = "https://tvl.fyi/";
+    title = "TVL blog";
+    subtitle = "Thoughts and news from The Virus Lounge";
+    authors = [ "tazjin" ]; # TODO(tazjin): Extract from post info
+
+    links = lib.singleton {
+      rel = "self";
+      href = "https://tvl.fyi/feed.atom";
+    };
+
+    entries = map (blog.toFeedEntry tvl.blog.config) publishedPosts;
+  };
+
+  atomFeed = writeText "feed.atom" (atom-feed.renderFeed feed);
+
+  homepage = tvl.template {
+    title = "The Virus Lounge";
+    content = ''
+      The Virus Lounge
+      ================
+
+      ----------------
+
+      <img class="tvl-logo" src="https://static.tvl.fyi/${depot.web.static.drvHash}/logo-animated.svg"
+           alt="Virus with lambda-shaped spike proteins sitting on an armchair">
+
+      Welcome to **The Virus Lounge**. We're a group of people who got
+      together in 2020, when we felt that there was not enough
+      spontaneous socialising on the internet.
+
+      Because of our shared interests in topics like **build systems**
+      and **monorepos** we started working on code together, in our
+      monorepo called the *depot*.
+
+      Feel free to explore the tech we have built so far, all our
+      systems are linked in the footer.
+
+      ----------------
+
+      ## Blog
+
+      Here are the most recent TVL blog posts.
+
+      ${listPosts publishedPosts}
+
+      You can also follow our [atom feed](https://tvl.fyi/feed.atom).
+
+      ----------------
+
+      ## Getting in touch
+
+      We mostly hang out on IRC. You can find us in [`#tvl`][tvl-irc]
+      on [hackint][], which is also reachable [via XMPP][hackint-xmpp]
+      at [`#tvl@irc.hackint.org`][tvl-xmpp] (sic!) and [via
+      Matrix][hackint-matrix] at [`#tvl:hackint.org`][tvl-matrix].
+
+      Hackint also provide a [web chat][tvl-webchat].
+
+      [tvl-irc]: ircs://irc.hackint.org:6697/#tvl
+      [hackint]: https://hackint.org/
+      [hackint-xmpp]: https://hackint.org/transport/xmpp
+      [tvl-xmpp]: xmpp:#tvl@irc.hackint.org?join
+      [hackint-matrix]: https://hackint.org/transport/matrix
+      [tvl-matrix]: https://matrix.to/#/#tvl:hackint.org
+      [tvl-webchat]: https://webirc.hackint.org/#ircs://irc.hackint.org/#tvl
+
+      Discussions of our software, patches, and anything else really
+      can also be sent to us via email to **depot@tvl.su**. You can
+      see the mails submitted to that list in our [public inbox][].
+
+      [public inbox]: https://inbox.tvl.su
+
+      ----------------
+
+      ## 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>
-        svg {
+        .tvl-graph-container {
+          max-width: inherit;
+        }
+
+        .tvl-graph-container svg {
           max-width: inherit;
           height: auto;
         }
+
+        .tvl-logo {
+          width: 60%;
+          display: block;
+          margin-left: auto;
+          margin-right: auto;
+        }
       </style>
-    </head>
-    <body class="light">
-      <header>
-        <h1><a class="blog-title" href="/">tazjin's Virus Lounge</a> </h1>
-        <hr>
-      </header>
-
-      <main>
-        <img alt="tazjin's Virus Lounge" src="/static/virus_lounge.webp">
-      </main>
-
-      <p>
-        Welcome to <b>tazjin's Virus Lounge</b>. 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.
-      </p>
-
-      <hr>
-      <h2>Where did all these people come from?</h2>
-
-      <p>
-        It's pretty straightforward. Feel free to click on people, too.
-      </p>
-      ${builtins.readFile tvlGraph}
-
-      <hr>
-      <footer>
-        <p class="footer">
-          <a class="uncoloured-link" href="https://tazj.in">homepage</a>
-          |
-          <a class="uncoloured-link" href="https://cs.tvl.fyi/depot/-/blob/README.md">code</a>
-          |
-          <a class="uncoloured-link" href="https://twitter.com/tazjin">twitter</a>
-        </p>
-        <p class="lod">ಠ_ಠ</p>
-      </footer>
-    </body>
-  '';
-in runCommandNoCC "website" {} ''
-  mkdir -p $out/static
+    '';
+  };
+in
+runCommand "website" { } ''
+  mkdir -p $out/blog
   cp ${homepage} $out/index.html
-  cp -r ${./static}/* $out/static
-
-  # Some assets are stolen from tazjin's blog
-  cp ${depot.users.tazjin.homepage}/static/jetbrains-* $out/static
-  cp ${depot.users.tazjin.homepage}/static/tazjin.css $out/static
+  ${postRenderingCommands tvl.blog.posts}
+  cp ${atomFeed} $out/feed.atom
 ''