diff options
author | Vincent Ambo <mail@tazj.in> | 2021-11-05T13·11+0100 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2021-11-05T14·24+0000 |
commit | 674603f6c8b91ca121a9ebfd4bb9a43ca89c009e (patch) | |
tree | 9a965e4932a5d53322099eb54eac31c650241f8d /web/tvl/default.nix | |
parent | 4b33401a361c5460e8b2a4f30224228e2c002180 (diff) |
feat(web/tvl): Render blog posts and atom feed for TVL r/3006
Includes the blog posts and feed in the $out directory, but without linking them from the TVL homepage yet. Change-Id: If9c094b29e43e9a81b0cc3d731261dc4b10557c1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3776 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'web/tvl/default.nix')
-rw-r--r-- | web/tvl/default.nix | 35 |
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 '' |