A Haskell/Hakyll static site generator forked from gwern.net. Content is written in Markdown (.page files), compiled to _site/, and optionally deployed to S3.
# System tools
brew install s3cmd tidy-html5 imagemagick exiftool parallel
# Node.js (for MathJax and the webhook server)
brew install node
npm install -g mathjax-node-page
# Haskell toolchain via ghcup
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
# Follow prompts; when asked, let it add ghcup to your shell profile.
source ~/.ghcup/env# Add swap space first if on a small VM — the Haskell build needs ~4 GB RAM
sudo fallocate -l 10G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile && sudo swapon /swapfile
echo '/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab
echo 10 | sudo tee /proc/sys/vm/swappiness
# System tools
sudo apt-get update
sudo apt-get install -y build-essential curl libgmp-dev libffi-dev libncurses-dev \
zlib1g-dev tidy imagemagick parallel s3cmd ripgrep npm
# Node.js MathJax renderer
npm install -g mathjax-node-page
# Haskell toolchain via ghcup
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
source ~/.ghcup/envAfter installation, confirm:
ghc --version # should print 9.6.x
cabal --version # should print 3.xgit clone https://github.com/shawwn/wiki ~/wiki
cd ~/wiki
# Make ghc/cabal available (add to ~/.bash_profile or ~/.bashrc to make permanent)
source ~/.ghcup/env
# Compile the Haskell generator (~10–20 min on first run; subsequent builds are fast)
cabal build wiki# Full pipeline: compile → clean → generate _site/ → sitemap/RSS/MathJax
./build.sh
# Or step by step:
cabal run wiki -- clean # wipe _site/ and _cache/
cabal run wiki -- build # generate _site/Output lands in _site/.
Start a live dev server that watches for changes and rebuilds automatically:
source ~/.ghcup/env
cabal run wiki -- watchThis serves _site/ at http://localhost:8000 with correct MIME types and no browser caching. Edit any .page file; Hakyll rebuilds incrementally and the browser sees the update on the next refresh.
- Create an S3 bucket (e.g.
www.yoursite.com), uncheck "Block all public access". - Enable Static website hosting on the bucket.
- Add a bucket policy allowing public reads:
{
"Version": "2008-10-17",
"Statement": [{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {"AWS": "*"},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::www.yoursite.com/*"
}]
}- Create an IAM access key and configure s3cmd:
s3cmd --configure- Add a DNS CNAME pointing your domain to the S3 website endpoint (e.g. via Cloudflare).
Edit env.sh and set your bucket, domain name, and RSS metadata:
export BUCKET="S3://www.yoursite.com"
export WEBSITE="www.yoursite.com"
export NAME="Your Name"# Build and sync to S3
./deploy.sh
# Or just sync (if _site/ is already built)
./sync.shindex.js is an Express server that listens on port 80 and runs ./deploy.sh when GitHub sends a push webhook.
npm install # install Express
npm start # start server on port 80 (requires root or port forwarding)Configure a GitHub webhook pointing to http://yourserver/webhooks/github.
If you're forking this for your own site, search and replace the existing branding:
# Find all references to replace
rg -i 'shawn'
rg -i 'shawwn.net'
rg 'UA-' # Google Analytics tracking IDs
# Files to edit:
# - env.sh (bucket, domain, name)
# - static/templates/default.html (site name, analytics, social links)
# - static/templates/analytics.html
# - gen_rss.py (feed metadata)*.page Markdown wiki articles
Main.hs Hakyll site generator
LinkMetadata.hs Link popup metadata scraper
Inflation.hs Dollar inflation adjuster
static/
templates/ HTML templates
metadata/ Cached link metadata (auto.hs, custom.hs)
css/ js/ img/ Static assets
docs/ PDFs and other referenced assets
_site/ Generated output (git-ignored)
_cache/ Hakyll build cache (git-ignored)
build.sh Full build pipeline
deploy.sh Build + sync
watch.sh Build + live-reload dev server
env.sh Site configuration (bucket, domain, RSS)
index.js GitHub webhook server