new 'ssg'

This commit is contained in:
root 2025-11-08 12:58:36 +00:00
parent 450a5ce1d6
commit ae414ceb12
13 changed files with 225 additions and 477 deletions

27
homepage/default.nix Normal file
View file

@ -0,0 +1,27 @@
{pkgs ? import <nixpkgs> {}}:
pkgs.stdenv.mkDerivation {
name = "distrust-homepage";
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
'';
}