about summary refs log tree commit diff
path: root/users/wpcarro/website/default.nix
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2021-12-30T19·34-0400
committerclbot <clbot@tvl.fyi>2022-01-08T05·33+0000
commitca6be786a18aedcb3d5a649a2b00973c3e38bc65 (patch)
treee0bec1ecb076f8dc279a4cdd223d5f7a2a758398 /users/wpcarro/website/default.nix
parent44f20ea8108c82eef254c5e031f59bbc21cf2992 (diff)
chore(wpcarro/website): Templatize website r/3538
Preferring billandhiscomputer.com in lieu of wpcarro.dev. wpcarro is a bit of a
tough username for others to remember and for me to say out-loud (it usually
involves me spelling it and explaining to others why Carroll is missing
2x-Ls). I think it's time for a change.

During the transition, I don't want to deal with stale links to
https://wpcarro.dev, so I'm templatizing more of my website and blog so that
these values can be replaced.

Expect more forthcoming changes.

Change-Id: Ic2f5519e6b0d76fcb8b737bf50009e8388f1b178
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4754
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Diffstat (limited to 'users/wpcarro/website/default.nix')
-rw-r--r--users/wpcarro/website/default.nix23
1 files changed, 19 insertions, 4 deletions
diff --git a/users/wpcarro/website/default.nix b/users/wpcarro/website/default.nix
index b20de562ab6f..9694aad17d60 100644
--- a/users/wpcarro/website/default.nix
+++ b/users/wpcarro/website/default.nix
@@ -4,18 +4,33 @@ let
   inherit (builtins) readFile;
   inherit (depot.users) wpcarro;
 
-  render = contentHtml: pkgs.substituteAll {
+  domain = "billandhiscomputer.com";
+
+  globalVars = {
+    inherit domain;
+    homepage  = "https://${domain}/";
+    blog      = "https://${domain}/blog";
+    habits    = "https://${domain}/habits";
+    github    = "https://github.com/wpcarro";
+    linkedin  = "https://linkedin.com/in/williampatrickcarroll";
+    depotWork = "https://cs.tvl.fyi/depot/-/blob/users/wpcarro";
+  };
+
+  renderTemplate = src: vars: pkgs.substituteAll (globalVars // vars // {
+    inherit src;
+  });
+
+  withBrand = contentHtml: renderTemplate ./fragments/template.html {
     inherit contentHtml;
-    src = ./fragments/template.html;
   };
 in {
-  inherit render;
+  inherit domain renderTemplate withBrand;
 
   root = pkgs.runCommandNoCC "wpcarro.dev" {} ''
     mkdir -p $out
 
     # /
-    cp ${render (readFile ./fragments/homepage.html)} $out/index.html
+    cp ${withBrand (readFile (renderTemplate ./fragments/homepage.html {}))} $out/index.html
 
     # /habits
     mkdir -p $out/habits