{pkgs ? import {}}: pkgs.stdenv.mkDerivation { name = "distrust-network-static-webroot"; src = ./.; buildInputs = [pkgs.gawk]; buildPhase = '' for bodyFile in *.body.html; do baseName=$(basename "$bodyFile" .body.html) title=$(echo "Distrust - ''${baseName^}" | sed "s/\\w(-)\\w/ /g") bodyContent=$(cat "$bodyFile") awk -v title="$title" -v body="$bodyContent" '{ gsub(/%%TITLE%%/, title); gsub(/%%BODY%%/, body); print; }' template.html > "$baseName.html" done ''; installPhase = '' mkdir -p $out cp * $out/ rm -f $out/template.html $out/*.body.html $out/*.nix ''; }