49 lines
2.1 KiB
Bash
49 lines
2.1 KiB
Bash
source $stdenv/setup
|
|
|
|
# Set up Ruby to use UTF-8
|
|
export RUBYOPT="-KU -E utf-8:utf-8"
|
|
|
|
# Copy files to a mutable directory.
|
|
cp -r $src/* .
|
|
# We'll generate some static files so make static writable
|
|
# We also store the code HTML files alongside Agda code, so make 'code' writable too
|
|
mkdir -p static && chmod -R u+w static code
|
|
|
|
# We host some static files (KaTeX CSS in production) on
|
|
# static.danilafe.com. However, we can just bundle them here instead!
|
|
# Configure Hugo to do so by writing the expected final paths to config-urls.toml
|
|
echo '[params]' >> config-urls.toml
|
|
echo 'katexCssUrl = "/katex/katex.min.css"' >> config-urls.toml
|
|
echo 'normalizeCssUrl = "/normalize/normalize.css"' >> config-urls.toml
|
|
echo 'visNetworkJsUrl = "/vis-network/vis-network.min.js"' >> config-urls.toml
|
|
echo 'bergamotJsUrl = "/bergamot/bergamot.js"' >> config-urls.toml
|
|
echo 'katexJsUrl = "/katex/katex.min.js"' >> config-urls.toml
|
|
echo 'resumeStaticFile = "/Resume-Danila-Fedorin.pdf"' >> config-urls.toml
|
|
|
|
# Build site with Hugo
|
|
hugo $hugoFlags --config=config.toml,config-urls.toml
|
|
|
|
# Create/copy 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
|
|
cp $resume/Resume-Danila-Fedorin.pdf static/Resume-Danila-Fedorin.pdf
|
|
cp -r $webFiles/* static/
|
|
cp -r $agdaHtml/* code/
|
|
|
|
# Static folder changed, re-run Hugo
|
|
hugo $hugoFlags --config=config.toml,config-urls.toml
|
|
|
|
# Do post-processing of HTML files: render math, link up Agda code, subset fonts and icons
|
|
gendir="public/$publicPath"
|
|
htmlfiles=$(find $gendir/ -regex "$gendir/.*\.html")
|
|
chmod -R u+w $gendir
|
|
echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./convert.rb --katex-js-file static/katex/katex.min.js
|
|
echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./agda.rb
|
|
echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./chatgpt-subset-feather-icon.rb $gendir/feather-sprite.svg
|
|
echo $htmlfiles | xargs python3 chatgpt-subset-one-go.py $gendir/fonts
|
|
|
|
# Output result
|
|
mkdir $out
|
|
cp -r $gendir/* $out/
|