From 895a679fd43f7e236135705aaee3d58201d32a1f Mon Sep 17 00:00:00 2001
From: Profpatsch
Date: Sat, 13 Nov 2021 12:38:49 +0100
Subject: pkgs/profpatsch.de: reference the blog and notes sections
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
---
pkgs/profpatsch/default.nix | 12 +++-
pkgs/profpatsch/profpatsch.de/default.nix | 86 +++++++++++++++++++++-------
pkgs/profpatsch/profpatsch.de/index.html.nix | 19 +++---
pkgs/profpatsch/profpatsch.de/talkies.js | 5 +-
4 files changed, 90 insertions(+), 32 deletions(-)
diff --git a/pkgs/profpatsch/default.nix b/pkgs/profpatsch/default.nix
index 10936366..47c7b402 100644
--- a/pkgs/profpatsch/default.nix
+++ b/pkgs/profpatsch/default.nix
@@ -103,6 +103,12 @@ let
in rec {
+ tvl = import (builtins.fetchGit {
+ url = "https://code.tvl.fyi/depot.git";
+ ref = "canon";
+ rev = "e2fbc10ebdb5d85813fd15c5dd371ee8e1e87a22"; # 2021-11-13
+ }) {};
+
inherit (nixperiments)
# canonical pattern matching primitive
match
@@ -212,9 +218,13 @@ in rec {
inherit symlink;
};
- inherit (import ./profpatsch.de { inherit pkgs lib toNetstring writeExecline runExecline getBins writeRustSimple netencode-rs el-semicolon el-exec el-substitute netencode record-get; })
+ inherit (import ./profpatsch.de {
+ inherit pkgs tvl lib
+ toNetstring toNetstringList writeExecline runExecline getBins writeRustSimple netencode-rs el-semicolon el-exec el-substitute netencode record-get;
+ })
websiteStatic
importas-if
+ concatenatedCss
;
inherit (import ./nix-tools.nix { inherit pkgs getBins writeExecline runblock backtick; })
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
}:
+
''
@@ -53,19 +55,16 @@
CV
- Hey there. Seems like you landed on my webpage.
-
- 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.
-
- 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.
+ Hey there.
- If you are searching for a skilled programmer to do some work for you, look no further.
- In case you want to know what I do in my free time, you can follow me on Twitter.
- On another note, you can find me practically everywhere under my nick (Github, G+, several mailinglists, SO, &c.)
+
Notes
+ ${notes-html-snippet}
- There you go. Cya!
+ Projects
+ ${projects-html-snippet}
+ Posts
+ ${posts-html-snippet}
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;
--
cgit 1.4.1