diff options
Diffstat (limited to 'users/tazjin/homepage')
16 files changed, 262 insertions, 0 deletions
diff --git a/users/tazjin/homepage/default.nix b/users/tazjin/homepage/default.nix new file mode 100644 index 000000000000..0edb75d60933 --- /dev/null +++ b/users/tazjin/homepage/default.nix @@ -0,0 +1,78 @@ +# Assembles the website index and configures an nginx instance to +# serve it. +# +# The website is made up of a simple header&footer and content +# elements for things such as blog posts and projects. +# +# Content for the blog is in //users/tazjin/blog instead of here. +{ depot, lib, pkgs, ... }@args: + +with depot; +with nix.yants; + +let + inherit (builtins) readFile replaceStrings sort; + inherit (pkgs) writeFile runCommandNoCC; + + # The different types of entries on the homepage. + entryClass = enum "entryClass" [ "blog" "project" "misc" ]; + + # The definition of a single entry. + entry = struct "entry" { + class = entryClass; + title = string; + url = string; + date = int; # epoch + description = option string; + }; + + escape = replaceStrings [ "<" ">" "&" "'" ] [ "<" ">" "&" "'" ]; + + postToEntry = defun [ web.blog.post entry ] (post: { + class = "blog"; + title = post.title; + url = "/blog/${post.key}"; + date = post.date; + }); + + formatDate = defun [ int string ] (date: readFile (runCommandNoCC "date" { } '' + date --date='@${toString date}' '+%Y-%m-%d' > $out + '')); + + formatEntryDate = defun [ entry string ] (entry: entryClass.match entry.class { + blog = "Blog post from ${formatDate entry.date}"; + project = "Project from ${formatDate entry.date}"; + misc = "Posted on ${formatDate entry.date}"; + }); + + entryToDiv = defun [ entry string ] (entry: '' + <a href="${entry.url}" class="entry ${entry.class}"> + <div> + <p class="entry-title">${escape entry.title}</p> + ${ + lib.optionalString ((entry ? description) && (entry.description != null)) + "<p class=\"entry-description\">${escape entry.description}</p>" + } + <p class="entry-date">${formatEntryDate entry}</p> + </div> + </a> + ''); + + index = entries: pkgs.writeText "index.html" (lib.concatStrings ( + [ (builtins.readFile ./header.html) ] + ++ (map entryToDiv (sort (a: b: a.date > b.date) entries)) + ++ [ (builtins.readFile ./footer.html) ] + )); + + pageEntries = import ./entries.nix; + homepage = index ((map postToEntry users.tazjin.blog.posts) ++ pageEntries); + atomFeed = import ./feed.nix (args // { inherit entry pageEntries; }); +in +runCommandNoCC "website" { } '' + mkdir $out + cp ${homepage} $out/index.html + cp ${atomFeed} $out/feed.atom + mkdir $out/static + cp -r ${depot.web.static}/* $out/static + cp -rf ${./static}/* $out/static +'' diff --git a/users/tazjin/homepage/entries.nix b/users/tazjin/homepage/entries.nix new file mode 100644 index 000000000000..9e43516e5358 --- /dev/null +++ b/users/tazjin/homepage/entries.nix @@ -0,0 +1,103 @@ +[ + { + class = "misc"; + title = "@tazlog on Telegram"; + url = "https://t.me/tazlog"; + date = 1643321164; + description = '' + My new channel on Telegram, for occasional updates smaller (and + more frequent) than what ends up being posted here. + ''; + } + { + class = "project"; + title = "Ship It! #37"; + url = "https://changelog.com/shipit/37"; + date = 1641819600; + description = '' + Episode #37 of Ship It!, a podcast about systems, featuring me. + We talk about TVL, Nix, monorepos and related things. + ''; + } + { + class = "project"; + title = "Tvix"; + url = "https://tvl.fyi/blog/rewriting-nix"; + date = 1638381387; + description = '' + TVL is rewriting Nix with funding from NLNet. + ''; + } + { + class = "misc"; + title = "Interview with Joscha Bach"; + url = "https://www.youtube.com/watch?v=P-2P3MSZrBM"; + date = 1594594800; + description = '' + A fascinating, mind-bending interview by Lex Fridman with Joscha + Bach about the Nature of the Universe. + ''; + } + { + class = "misc"; + title = "The Virus Lounge"; + url = "https://tvl.fyi"; + date = 1587435629; + description = "A community around Nix, monorepos, build tooling and the like!"; + } + { + class = "project"; + title = "depot"; + url = "https://code.tvl.fyi/about"; + date = 1576800000; + description = "Merging all of my projects into a single, Nix-based monorepo"; + } + { + class = "project"; + title = "Nixery"; + url = "https://github.com/google/nixery"; + date = 1565132400; + description = "A Nix-backed container registry that builds container images on demand"; + } + { + class = "project"; + title = "kontemplate"; + url = "https://code.tvl.fyi/about/ops/kontemplate"; + date = 1486550940; + description = "Simple file templating tool built for Kubernetes resources"; + } + { + class = "misc"; + title = "dottime"; + url = "https://dotti.me/"; + date = 1560898800; + description = "A universal convention for conveying time (by edef <3)"; + } + { + class = "project"; + title = "journaldriver"; + url = "https://code.tvl.fyi/about/ops/journaldriver"; + date = 1527375600; + description = "Small daemon to forward logs from journald to Stackdriver Logging"; + } + { + class = "misc"; + title = "Principia Discordia"; + url = "https://principiadiscordia.com/book/1.php"; + date = 1495494000; + description = '' + The Principia is a short book I read as a child, and didn't + understand until much later. It shaped much of my world view. + ''; + } + { + class = "misc"; + title = "This Week in Virology"; + url = "http://www.microbe.tv/twiv/"; + date = 1585517557; + description = '' + Podcast with high-quality information about virology, + epidemiology and so on. Highly relevant to COVID19. + ''; + } +] diff --git a/users/tazjin/homepage/feed.nix b/users/tazjin/homepage/feed.nix new file mode 100644 index 000000000000..09bc36341401 --- /dev/null +++ b/users/tazjin/homepage/feed.nix @@ -0,0 +1,43 @@ +# Creates the Atom feed for my homepage. +{ depot, lib, pkgs, entry, pageEntries, ... }: + +with depot.nix.yants; + +let + inherit (builtins) map readFile; + inherit (lib) max singleton; + inherit (pkgs) writeText; + inherit (depot.web) blog atom-feed; + + pageEntryToEntry = defun [ entry atom-feed.entry ] (e: { + id = "tazjin:${e.class}:${toString e.date}"; + updated = e.date; + published = e.date; + title = e.title; + summary = e.description; + + links = singleton { + rel = "alternate"; + href = e.url; + }; + }); + + allEntries = (with depot.users.tazjin.blog; map (blog.toFeedEntry config) posts) + ++ (map pageEntryToEntry pageEntries); + + feed = { + id = "https://tazj.in/"; + title = "tazjin's interblag"; + subtitle = "my posts, projects and other interesting things"; + rights = "© 2020 tazjin"; + authors = [ "tazjin" ]; + + links = singleton { + rel = "self"; + href = "https://tazjin/feed.atom"; + }; + + entries = allEntries; + }; +in +writeText "feed.atom" (atom-feed.renderFeed feed) diff --git a/users/tazjin/homepage/footer.html b/users/tazjin/homepage/footer.html new file mode 100644 index 000000000000..2f17135066e8 --- /dev/null +++ b/users/tazjin/homepage/footer.html @@ -0,0 +1,2 @@ + </div> +</body> diff --git a/users/tazjin/homepage/header.html b/users/tazjin/homepage/header.html new file mode 100644 index 000000000000..5a22d9eb7b45 --- /dev/null +++ b/users/tazjin/homepage/header.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<head><meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="description" content="tazjin's blog"> + <link rel="stylesheet" type="text/css" href="static/tvl.css" media="all"> + <link rel="icon" type="image/webp" href="/static/favicon.webp"> + <link rel="alternate" type="application/atom+xml" href="/feed.atom"> + <title>tazjin's interblag</title> +</head> +<body class="dark"> + <header> + <h1> + <a class="interblag-title" href="/">tazjin's interblag</a> + </h1> + <hr> + </header> + <div class="introduction"> + <p>Hi, I'm tazjin.</p> + <p> + I spend a lot of my time hacking on the + <a class="dark-link" href="https://tvl.fyi">TVL</a> monorepo and + doing other computer-related things. Follow me + on <a class="dark-link" href="https://t.me/tazlog">Telegram</a>, + via the feed here or (occasionally) catch me in-person + at <a href="https://undef.club/#about" class="dark-link"> + undef.club</a>. + </p> + <p> + Below is a collection of + my <span class="project">projects</span>, <span class="blog">blog + posts</span> and some <span class="misc">random things</span> by + me or others. If you'd like to get in touch about anything, send + me a mail at mail@[this domain] or ping me on IRC. + </p> + </div> + <div class="entry-container"> diff --git a/users/tazjin/homepage/static/favicon.webp b/users/tazjin/homepage/static/favicon.webp new file mode 100644 index 000000000000..f99c9085340b --- /dev/null +++ b/users/tazjin/homepage/static/favicon.webp Binary files differdiff --git a/users/tazjin/homepage/static/img/nixery/dominator.webp b/users/tazjin/homepage/static/img/nixery/dominator.webp new file mode 100644 index 000000000000..2d8569a6ca21 --- /dev/null +++ b/users/tazjin/homepage/static/img/nixery/dominator.webp Binary files differdiff --git a/users/tazjin/homepage/static/img/nixery/example_extra.webp b/users/tazjin/homepage/static/img/nixery/example_extra.webp new file mode 100644 index 000000000000..101f0f633aef --- /dev/null +++ b/users/tazjin/homepage/static/img/nixery/example_extra.webp Binary files differdiff --git a/users/tazjin/homepage/static/img/nixery/example_plain.webp b/users/tazjin/homepage/static/img/nixery/example_plain.webp new file mode 100644 index 000000000000..a2b90b3e21d5 --- /dev/null +++ b/users/tazjin/homepage/static/img/nixery/example_plain.webp Binary files differdiff --git a/users/tazjin/homepage/static/img/nixery/ideal_layout.webp b/users/tazjin/homepage/static/img/nixery/ideal_layout.webp new file mode 100644 index 000000000000..0e9f74556682 --- /dev/null +++ b/users/tazjin/homepage/static/img/nixery/ideal_layout.webp Binary files differdiff --git a/users/tazjin/homepage/static/img/watchblob_1.webp b/users/tazjin/homepage/static/img/watchblob_1.webp new file mode 100644 index 000000000000..27e588e1a145 --- /dev/null +++ b/users/tazjin/homepage/static/img/watchblob_1.webp Binary files differdiff --git a/users/tazjin/homepage/static/img/watchblob_2.webp b/users/tazjin/homepage/static/img/watchblob_2.webp new file mode 100644 index 000000000000..b2dea98b4fb4 --- /dev/null +++ b/users/tazjin/homepage/static/img/watchblob_2.webp Binary files differdiff --git a/users/tazjin/homepage/static/img/watchblob_3.webp b/users/tazjin/homepage/static/img/watchblob_3.webp new file mode 100644 index 000000000000..99b49373b5b4 --- /dev/null +++ b/users/tazjin/homepage/static/img/watchblob_3.webp Binary files differdiff --git a/users/tazjin/homepage/static/img/watchblob_4.webp b/users/tazjin/homepage/static/img/watchblob_4.webp new file mode 100644 index 000000000000..41dbdb6be1cf --- /dev/null +++ b/users/tazjin/homepage/static/img/watchblob_4.webp Binary files differdiff --git a/users/tazjin/homepage/static/img/watchblob_5.webp b/users/tazjin/homepage/static/img/watchblob_5.webp new file mode 100644 index 000000000000..c42a4ce1bc0f --- /dev/null +++ b/users/tazjin/homepage/static/img/watchblob_5.webp Binary files differdiff --git a/users/tazjin/homepage/static/img/watchblob_6.webp b/users/tazjin/homepage/static/img/watchblob_6.webp new file mode 100644 index 000000000000..1440761859dd --- /dev/null +++ b/users/tazjin/homepage/static/img/watchblob_6.webp Binary files differ |