new 'ssg'
This commit is contained in:
parent
450a5ce1d6
commit
ae414ceb12
13 changed files with 225 additions and 477 deletions
27
homepage/default.nix
Normal file
27
homepage/default.nix
Normal 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
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue