diff options
author | William Carroll <wpcarro@gmail.com> | 2021-12-28T00·06-0400 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2021-12-28T00·09+0000 |
commit | e107311cb87fc219889f37f0c67cfea22b4a99e7 (patch) | |
tree | f52e7b5859eabb14a9cbeb17e68aa741ea9c3348 /users/wpcarro/website/default.nix | |
parent | 52369a11e3dee035b575281c80e2bf9a65546435 (diff) |
refactor(wpcarro/website): Prefer substituteAll r/3483
`substituteAll` supports templating with @variables@, which I think really cleans things up. Change-Id: Icfad15ac9e174495ba02260d817f7330f1616c6f Reviewed-on: https://cl.tvl.fyi/c/depot/+/4722 Reviewed-by: wpcarro <wpcarro@gmail.com> Autosubmit: wpcarro <wpcarro@gmail.com> Tested-by: BuildkiteCI
Diffstat (limited to 'users/wpcarro/website/default.nix')
-rw-r--r-- | users/wpcarro/website/default.nix | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/users/wpcarro/website/default.nix b/users/wpcarro/website/default.nix index 60d8dc19e768..e8f2161792ca 100644 --- a/users/wpcarro/website/default.nix +++ b/users/wpcarro/website/default.nix @@ -1,27 +1,27 @@ { pkgs, depot, ... }: -rec { +let + inherit (builtins) readFile; inherit (depot.users) wpcarro; - header = "${./fragments/header.html}"; - footer = "${./fragments/footer.html}"; - addendum = "${./fragments/addendum.html}"; + render = contentHtml: pkgs.substituteAll { + inherit contentHtml; + src = ./fragments/template.html; + }; +in { + inherit render; - root = pkgs.stdenv.mkDerivation { - name = "wpcarro.dev"; - src = builtins.path { path = ./.; name = "website"; }; - installPhase = '' - mkdir -p $out + root = pkgs.runCommandNoCC "wpcarro.dev" {} '' + mkdir -p $out - cat ${header} \ - ${./fragments/homepage.html} \ - ${footer} \ - ${addendum} > $out/index.html + # / + cp ${render (readFile ./fragments/homepage.html)} $out/index.html - mkdir -p $out/habits - cp -r ${wpcarro.website.habit-screens} $out/habits/index.html + # /habits + mkdir -p $out/habits + cp -r ${wpcarro.website.habit-screens} $out/habits/index.html - cp -r ${wpcarro.website.blog.root} $out/blog - ''; - }; + # /blog + cp -r ${wpcarro.website.blog.root} $out/blog + ''; } |