diff options
author | Profpatsch <mail@profpatsch.de> | 2021-11-13 12:38:49 +0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2021-11-13 12:38:49 +0100 |
commit | 895a679fd43f7e236135705aaee3d58201d32a1f (patch) | |
tree | 1bbf631fae80efac2591a61079d33abc512b584f /pkgs/profpatsch/profpatsch.de | |
parent | 18e4d17ce20724279b985e32232bb166fa7b163b (diff) |
pkgs/profpatsch.de: reference the blog and notes sections
This pulls in tvl, since the blog ist mostly over there. It uses `fetchGit`, so caveats may apply. It shouldn’t increase evaluation times very much, since the blog only uses a small subset of tvl. https://github.com/openlab-aux/vuizvui/issues/50 might apply.
Diffstat (limited to 'pkgs/profpatsch/profpatsch.de')
-rw-r--r-- | pkgs/profpatsch/profpatsch.de/default.nix | 86 | ||||
-rw-r--r-- | pkgs/profpatsch/profpatsch.de/index.html.nix | 19 | ||||
-rw-r--r-- | pkgs/profpatsch/profpatsch.de/talkies.js | 5 |
3 files changed, 79 insertions, 31 deletions
diff --git a/pkgs/profpatsch/profpatsch.de/default.nix b/pkgs/profpatsch/profpatsch.de/default.nix index 9f15cd2a..92b8d35d 100644 --- a/pkgs/profpatsch/profpatsch.de/default.nix +++ b/pkgs/profpatsch/profpatsch.de/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, toNetstring, writeExecline, runExecline, getBins, writeRustSimple, netencode-rs, el-semicolon, el-substitute, el-exec, netencode, record-get }: +{ pkgs, tvl, lib, toNetstring, toNetstringList, writeExecline, runExecline, getBins, writeRustSimple, netencode-rs, el-semicolon, el-substitute, el-exec, netencode, record-get }: let bins = getBins pkgs.coreutils [ "ln" "mkdir" "echo" "printenv" "cat" "env" ] @@ -20,13 +20,23 @@ let "pipeline" [ bins.multitee "0-1,2" ] "$@" ]; - applyTemplate = name: templateNix: deps: + applyTemplate = { + name, + # the nix template file to import + templateNix, + # the page dependencies, attrset of path, relativeDir and relativeFile + pageDeps, + # html that should just be interpolated; + # will shadow any attrs in pageDeps of the same name + interpolateHtml ? {}, + }: pkgs.writeText name (import templateNix - (lib.mapAttrs - # relative to the root of the webpage - (k: v: "/" + (joinPath (v.relativeDir ++ [ v.relativeFile ]))) - deps)); + ((lib.mapAttrs + # relative to the root of the webpage + (k: v: "/" + (joinPath (v.relativeDir ++ [ v.relativeFile ]))) + pageDeps) + // interpolateHtml)); staticFiles = rec { @@ -43,13 +53,34 @@ let cssMain = { relativeDir = [ "css" ]; relativeFile = "main.css"; - path = applyTemplate "main.css" ./main.css.nix { - inherit - fontsQuattrocentoLatin - fontsOpenSansLatin - ; + path = applyTemplate { + name = "main.css"; + templateNix = ./main.css.nix; + pageDeps = { + inherit + fontsQuattrocentoLatin + fontsOpenSansLatin + ; + }; }; }; + cssConcatenated = + let + concatCss = cssFiles: runExecline "concat-css" { + stdin = toNetstringList (map (c: c.path) cssFiles); + } [ + "importas" "out" "out" + "forstdin" "-Ed" "" "css" + "redirfd" "-a" "1" "$out" + "redirfd" "-r" "0" "$css" + bins.cat + ]; + in { + relativeDir = [ "css" ]; + relativeFile = "concatenated.css"; + path = concatCss [cssNormalize cssMain]; + }; + fontsQuattrocentoLatin = { relativeDir = [ "fonts" ]; relativeFile = "quattrocento-latin.woff2"; @@ -78,15 +109,24 @@ let index_html = { relativeDir = []; relativeFile = "index.html"; - path = applyTemplate "index.html" ./index.html.nix { - inherit jsTalkies; - inherit cssNormalize cssMain; - inherit cv_pdf id_txt; - # preloading - inherit - fontsQuattrocentoLatin - fontsOpenSansLatin - ; + path = applyTemplate { + name = "index.html"; + templateNix = ./index.html.nix; + pageDeps = { + inherit jsTalkies; + inherit cssNormalize cssMain; + inherit cv_pdf id_txt; + # preloading + inherit + fontsQuattrocentoLatin + fontsOpenSansLatin + ; + }; + interpolateHtml = { + notes-html-snippet = tvl.users.Profpatsch.blog.notes-index-html; + projects-html-snippet = tvl.users.Profpatsch.blog.projects-index-html; + posts-html-snippet = tvl.users.Profpatsch.blog.posts-index-html; + }; }; }; toc = { @@ -96,6 +136,11 @@ let }; }; + concatenatedCss = + let mkRoute = css: { route = css.relativeDir ++ [ css.relativeFile ]; }; + in mkRoute staticFiles.cssConcatenated; + + importas-if = writeRustSimple "importas-if" { dependencies = [ netencode-rs el-substitute el-exec ]; # TODO: for some reason the skarnet linker flag @@ -168,5 +213,6 @@ in { websiteStatic record-get importas-if + concatenatedCss ; } diff --git a/pkgs/profpatsch/profpatsch.de/index.html.nix b/pkgs/profpatsch/profpatsch.de/index.html.nix index e6c73b14..da2ba95e 100644 --- a/pkgs/profpatsch/profpatsch.de/index.html.nix +++ b/pkgs/profpatsch/profpatsch.de/index.html.nix @@ -2,7 +2,9 @@ , cssNormalize, cssMain , id_txt, cv_pdf , fontsQuattrocentoLatin, fontsOpenSansLatin +, notes-html-snippet, projects-html-snippet, posts-html-snippet }: + '' <!DOCTYPE html> <html> @@ -53,19 +55,16 @@ <a href="${cv_pdf}">CV</a> </p> - <p>Hey there. Seems like you landed on my webpage.</p> - - <p>Well, more like a simple HTML page. But that’s fine for the moment, since I don’t use it as a web presence yet. - I may when I finally write those articles I have in mind, but for now you are stuck with this.</p> - - <p>That’s not a problem, though, since other people do a lot better job at designing these. For example the folks at Youtube, StackExchange or Github.</p> + <p>Hey there.</p> - <p>If you are searching for a skilled programmer to do some work for you, <a href="${cv_pdf}">look no further</a>. - In case you want to know what I do in my free time, you can <a href="https://twitter.com/Profpatsch/">follow me on Twitter</a>.</p> - <p>On another note, you can find me practically everywhere under my nick (Github, G+, several mailinglists, SO, &c.) + <h1>Notes</h1> + ${notes-html-snippet} - <p>There you go. Cya!</p> + <h1>Projects</h1> + ${projects-html-snippet} + <h1>Posts</h1> + ${posts-html-snippet} </main> </body> diff --git a/pkgs/profpatsch/profpatsch.de/talkies.js b/pkgs/profpatsch/profpatsch.de/talkies.js index 8c574fcf..e961c755 100644 --- a/pkgs/profpatsch/profpatsch.de/talkies.js +++ b/pkgs/profpatsch/profpatsch.de/talkies.js @@ -150,7 +150,10 @@ function appendTalkies(append_to_element) { { talk: "PROPPATCH", hover: "WebDAV was a mistake" }, { talk: "sausage shaped, but lumpy", - link: "https://en.wikipedia.org/wiki/Bristol_stool_scale" } + link: "https://en.wikipedia.org/wiki/Bristol_stool_scale" }, + { talk: "polsterboi.json.mozlz4" }, + { talk: "buffer-local when set" } + ]; var talkie = talkies[Math.floor(Math.random()*talkies.length)]; var elem = null; |