about summary refs log tree commit diff
path: root/users/wpcarro/website/blog/default.nix
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2021-12-27T13·38-0400
committerclbot <clbot@tvl.fyi>2021-12-27T14·01+0000
commitbb72d16cce4b2cee6a31f0aa3fdcf5cad8890de9 (patch)
treee16feb33c6107ff60ccf10bb856cd837c5806358 /users/wpcarro/website/blog/default.nix
parent21e1ae3e69a0d019c5792ebb463877bd98c1d161 (diff)
refactor(wpcarro/blog): Prefer depot.web.blog r/3465
Hugo is a bit too heavyweight for my taste.

Change-Id: I331bc5898bd40f1a03bbde8ad69fe3cc9f72c18b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4704
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/wpcarro/website/blog/default.nix')
-rw-r--r--users/wpcarro/website/blog/default.nix31
1 files changed, 23 insertions, 8 deletions
diff --git a/users/wpcarro/website/blog/default.nix b/users/wpcarro/website/blog/default.nix
index cea9e8706cd6..df5502330ce3 100644
--- a/users/wpcarro/website/blog/default.nix
+++ b/users/wpcarro/website/blog/default.nix
@@ -1,12 +1,27 @@
-{ pkgs, ... }:
+{ depot, lib, pkgs, ... }:
 
-pkgs.stdenv.mkDerivation {
-  name = "blog.wpcarro.dev";
-  buildInputs = with pkgs; [ hugo ];
-  src = builtins.path { path = ./.; name = "blog"; };
-  buildPhase = ''
+with depot.nix.yants;
+
+let
+  inherit (builtins) hasAttr filter;
+  inherit (depot.web.blog) post includePost renderPost;
+
+  config = {
+    name = "wpcarro's blog";
+    baseUrl = "https://blog.wpcarro.dev";
+    footer = "";
+  };
+
+  posts = filter includePost (list post (import ./posts.nix));
+
+  rendered = pkgs.runCommandNoCC "wpcarros-blog" {} ''
     mkdir -p $out
-    ${pkgs.hugo}/bin/hugo --minify --destination $out
+
+    ${lib.concatStringsSep "\n" (map (post:
+      "cp ${renderPost config post} $out/${post.key}.html"
+    ) posts)}
   '';
-  dontInstall = true;
+
+in {
+  inherit posts rendered config;
 }