2020-04-06 16:51:17 -07:00
|
|
|
source $stdenv/setup
|
2020-04-07 17:52:27 -07:00
|
|
|
|
2022-12-30 15:41:50 -08:00
|
|
|
# Set up Ruby to use UTF-8
|
|
|
|
|
export RUBYOPT="-KU -E utf-8:utf-8"
|
|
|
|
|
|
2020-09-03 00:03:02 +00:00
|
|
|
# Copy files to a mutable directory.
|
2020-04-06 16:51:17 -07:00
|
|
|
cp -r $src/* .
|
2022-12-30 15:41:50 -08:00
|
|
|
# We'll generate some static files so make static writable
|
2024-05-24 20:33:34 +00:00
|
|
|
# We also store the code HTML files alongside Agda code, so make 'code' writable too
|
|
|
|
|
mkdir -p static && chmod -R u+w static code
|
2020-09-03 00:03:02 +00:00
|
|
|
|
2023-11-30 07:09:28 +00:00
|
|
|
# We host some static files (KaTeX CSS in production) on
|
|
|
|
|
# static.danilafe.com. However, we can just bundle them here instead!
|
2024-05-24 20:33:34 +00:00
|
|
|
# Configure Hugo to do so by writing the expected final paths to config-urls.toml
|
2023-11-30 07:09:28 +00:00
|
|
|
echo '[params]' >> config-urls.toml
|
|
|
|
|
echo 'katexCssUrl = "/katex/katex.min.css"' >> config-urls.toml
|
2023-12-30 22:54:10 +00:00
|
|
|
echo 'normalizeCssUrl = "/normalize/normalize.css"' >> config-urls.toml
|
|
|
|
|
echo 'visNetworkJsUrl = "/vis-network/vis-network.min.js"' >> config-urls.toml
|
2023-11-30 07:09:28 +00:00
|
|
|
echo 'bergamotJsUrl = "/bergamot/bergamot.js"' >> config-urls.toml
|
2023-12-31 03:46:48 +00:00
|
|
|
echo 'katexJsUrl = "/katex/katex.min.js"' >> config-urls.toml
|
2023-12-30 23:09:44 +00:00
|
|
|
echo 'resumeStaticFile = "/Resume-Danila-Fedorin.pdf"' >> config-urls.toml
|
2023-12-30 22:54:10 +00:00
|
|
|
|
2020-09-03 00:03:02 +00:00
|
|
|
# Build site with Hugo
|
2024-05-16 23:08:27 +00:00
|
|
|
hugo $hugoFlags --config=config.toml,config-urls.toml
|
2022-12-30 15:41:50 -08:00
|
|
|
|
2024-05-24 20:33:34 +00:00
|
|
|
# Create/copy generated files
|
2022-12-30 15:41:50 -08:00
|
|
|
# Can't do submodules because nix flake inputs get their .git deleted
|
2023-01-01 21:34:07 +00:00
|
|
|
mkdir -p static/graph && ruby ./analyze.rb > static/graph/graph.gen.js # Graph files
|
2022-12-30 15:41:50 -08:00
|
|
|
stork build --input public/index.toml --output static/index.st # Search index
|
2023-02-20 05:49:59 +00:00
|
|
|
cp $resume/Resume-Danila-Fedorin.pdf static/Resume-Danila-Fedorin.pdf
|
2024-05-24 20:33:34 +00:00
|
|
|
cp -r $webFiles/* static/
|
|
|
|
|
cp -r $agdaHtml/* code/
|
2022-12-30 15:41:50 -08:00
|
|
|
|
|
|
|
|
# Static folder changed, re-run Hugo
|
2025-03-03 07:37:41 +00:00
|
|
|
hugo $hugoFlags --config=config.toml,config-urls.toml
|
2020-04-07 17:52:27 -07:00
|
|
|
|
2025-02-23 21:07:14 +00:00
|
|
|
# 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
|
2024-05-24 04:23:25 +00:00
|
|
|
echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./convert.rb --katex-js-file static/katex/katex.min.js
|
2024-05-23 07:37:52 +00:00
|
|
|
echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./agda.rb
|
2025-02-23 21:07:14 +00:00
|
|
|
echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./chatgpt-subset-feather-icon.rb $gendir/feather-sprite.svg
|
2025-02-24 01:05:16 +00:00
|
|
|
echo $htmlfiles | xargs python3 chatgpt-subset-one-go.py $gendir/fonts
|
2025-02-23 21:07:14 +00:00
|
|
|
|
|
|
|
|
# Output result
|
|
|
|
|
mkdir $out
|
|
|
|
|
cp -r $gendir/* $out/
|