tvl-depot/users/wpcarro/website/default.nix
William Carroll ca6be786a1 chore(wpcarro/website): Templatize website
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>
2022-01-08 05:33:02 +00:00

42 lines
1 KiB
Nix

{ pkgs, depot, ... }:
let
inherit (builtins) readFile;
inherit (depot.users) wpcarro;
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;
};
in {
inherit domain renderTemplate withBrand;
root = pkgs.runCommandNoCC "wpcarro.dev" {} ''
mkdir -p $out
# /
cp ${withBrand (readFile (renderTemplate ./fragments/homepage.html {}))} $out/index.html
# /habits
mkdir -p $out/habits
cp -r ${wpcarro.website.habit-screens} $out/habits/index.html
# /blog
cp -r ${wpcarro.website.blog} $out/blog
'';
}