about summary refs log tree commit diff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/tvl/default.nix35
1 files changed, 33 insertions, 2 deletions
diff --git a/web/tvl/default.nix b/web/tvl/default.nix
index e918fc4a998a..c40335003139 100644
--- a/web/tvl/default.nix
+++ b/web/tvl/default.nix
@@ -1,7 +1,20 @@
-{ depot, pkgs, ... }:
+{ depot, lib, pkgs, ... }:
+
+with depot.nix.yants;
 
 let
   inherit (pkgs) graphviz runCommandNoCC writeText;
+  inherit (depot.web) blog atom-feed;
+
+  blogConfig = {
+    name = "TVL's blog";
+    footer = depot.web.tvl.footer {};
+  };
+
+  postRenderingCommands = defun [ (list blog.post) string ] (posts:
+    lib.concatStringsSep "\n"
+      (map (p: "cp ${blog.renderPost blogConfig p} $out/blog/${p.key}.html") posts)
+  );
 
   tvlGraph = runCommandNoCC "tvl.svg" {
     nativeBuildInputs = with pkgs; [ fontconfig freetype cairo jetbrains-mono ];
@@ -9,6 +22,22 @@ let
     ${graphviz}/bin/neato -Tsvg ${./tvl.dot} > $out
   '';
 
+  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 depot.web.tvl.blog.posts;
+  };
+
+  atomFeed = writeText "feed.atom" (atom-feed.renderFeed feed);
+
   homepage = depot.web.tvl.template {
     title = "The Virus Lounge";
     content = ''
@@ -78,6 +107,8 @@ let
     '';
   };
 in runCommandNoCC "website" {} ''
-  mkdir -p $out/static
+  mkdir -p $out/blog
   cp ${homepage} $out/index.html
+  ${postRenderingCommands depot.web.tvl.blog.posts}
+  cp ${atomFeed} $out/feed.atom
 ''