Spaces:
Running on Zero
Running on Zero
File size: 864 Bytes
13e1f35 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #!/usr/bin/env bash
# Installs elan + Lean 4 + a Mathlib project with prebuilt cache into $HOME/leancheck.
# Idempotent: re-running skips what is already there. Runs at every Space start
# (the Space disk is not persistent), takes ~5-10 minutes on a cold start.
set -euo pipefail
export PATH="$HOME/.elan/bin:$PATH"
if [ ! -x "$HOME/.elan/bin/lake" ]; then
echo "== installing elan"
curl -sSfL https://elan.lean-lang.org/elan-init.sh -o /tmp/elan-init.sh
sh /tmp/elan-init.sh -y --default-toolchain none --no-modify-path
fi
cd "$HOME"
if [ ! -f leancheck/lakefile.toml ] && [ ! -f leancheck/lakefile.lean ]; then
echo "== creating Mathlib project"
rm -rf leancheck
lake +leanprover-community/mathlib4:lean-toolchain new leancheck math
fi
cd leancheck
echo "== downloading prebuilt Mathlib"
lake exe cache get
mkdir -p scratch
echo "LEAN-SETUP-DONE"
|