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-02 17:03:02 -07: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
|
2023-02-19 22:57:07 -08:00
|
|
|
mkdir -p static && chmod -R u+w static
|
2020-09-02 17:03:02 -07:00
|
|
|
|
2023-11-29 23:09:28 -08:00
|
|
|
# We host some static files (KaTeX CSS in production) on
|
|
|
|
# static.danilafe.com. However, we can just bundle them here instead!
|
2023-12-30 15:09:44 -08:00
|
|
|
# Also, since we're generating and adding a resume further down, add it to
|
|
|
|
# the configuration here as well.
|
2023-11-29 23:09:28 -08:00
|
|
|
echo '[params]' >> config-urls.toml
|
|
|
|
echo 'katexCssUrl = "/katex/katex.min.css"' >> config-urls.toml
|
2023-12-30 14:54:10 -08:00
|
|
|
echo 'normalizeCssUrl = "/normalize/normalize.css"' >> config-urls.toml
|
|
|
|
echo 'visNetworkJsUrl = "/vis-network/vis-network.min.js"' >> config-urls.toml
|
2023-11-29 23:09:28 -08:00
|
|
|
echo 'bergamotJsUrl = "/bergamot/bergamot.js"' >> config-urls.toml
|
2023-12-30 19:46:48 -08:00
|
|
|
echo 'katexJsUrl = "/katex/katex.min.js"' >> config-urls.toml
|
2023-12-30 15:09:44 -08:00
|
|
|
echo 'resumeStaticFile = "/Resume-Danila-Fedorin.pdf"' >> config-urls.toml
|
2023-12-30 14:54:10 -08:00
|
|
|
|
2023-11-29 23:09:28 -08:00
|
|
|
cp -r $webFiles/* static/
|
|
|
|
|
2020-09-02 17:03:02 -07:00
|
|
|
# Build site with Hugo
|
2023-11-29 23:09:28 -08:00
|
|
|
hugo $hugoFlags --config=config.toml,config-urls.toml,config-gen.toml
|
2022-12-30 15:41:50 -08:00
|
|
|
|
|
|
|
# Create generated files
|
|
|
|
# Can't do submodules because nix flake inputs get their .git deleted
|
2023-01-01 13:34:07 -08: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-19 21:49:59 -08:00
|
|
|
cp $resume/Resume-Danila-Fedorin.pdf static/Resume-Danila-Fedorin.pdf
|
2022-12-30 15:41:50 -08:00
|
|
|
|
|
|
|
# Static folder changed, re-run Hugo
|
2023-11-29 23:09:28 -08:00
|
|
|
hugo $hugoFlags --config=config.toml,config-urls.toml,config-gen.toml
|
2020-04-07 17:52:27 -07:00
|
|
|
|
|
|
|
# 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
|