blog-static-flake/build/builder.sh

28 lines
796 B
Bash
Raw Normal View History

2020-04-06 16:51:17 -07:00
source $stdenv/setup
# Set up Ruby to use UTF-8
export RUBYOPT="-KU -E utf-8:utf-8"
2020-09-02 17:03:02 -07:00
# Copy files to a mutable directory.
2020-04-06 16:51:17 -07:00
cp -r $src/* .
# We'll generate some static files so make static writable
chmod -R u+w static
2020-09-02 17:03:02 -07:00
# Build site with Hugo
hugo $hugoFlags --config=config.toml,config-gen.toml
# Create generated files
# Can't do submodules because nix flake inputs get their .git deleted
mkdir -p static/graph && ruby ./analyze.rb > static/graph/graph.gen.js # Graph files
stork build --input public/index.toml --output static/index.st # Search index
# Static folder changed, re-run Hugo
hugo $hugoFlags --config=config.toml,config-gen.toml
# Output result
mkdir $out
2020-09-02 17:03:02 -07:00
cp -r public/$publicPath/* $out/
# Render math in HTML and XML files.
2022-03-27 18:47:07 -07:00
find $out/ -regex "$out/.*\.html" | xargs katex-html