Lemma is a rewrite of elan that addresses critical usability issues, particularly around proxy support and custom toolchain sources.
After analyzing the elan codebase, we identified several critical issues that make it difficult to use in enterprise and restricted network environments:
- HTTP, HTTPS, and SOCKS5 proxies with authentication
- Standard environment variables:
HTTP_PROXY,HTTPS_PROXY,NO_PROXY
- Configure custom registry URLs
release_url = "https://release.custom.org"Linux / macOS:
curl --proto '=https' --tlsv1.2 -sSf https://lemma.puqing.work/install.sh | shOr download and inspect the script first:
curl --proto '=https' --tlsv1.2 -sSfL https://lemma.puqing.work/install.sh -o install.sh
chmod +x install.sh
./install.shWindows (PowerShell):
irm https://lemma.puqing.work/install.ps1 | iexOr download and inspect the script first:
Invoke-WebRequest -Uri https://lemma.puqing.work/install.ps1 -OutFile install.ps1
.\install.ps1# Build from source
cargo build --release
# Install
cargo install --path .Once installed, you can update lemma itself:
lemma self updateThis will check for the latest version and download it automatically if a newer version is available.
# Install a toolchain
lemma toolchain install stable
lemma toolchain install nightly
lemma toolchain install v4.0.0
# List installed toolchains
lemma toolchain list
# Set default toolchain
lemma default stable
# Update toolchains
lemma update
# Show information
lemma info
# Self-management
lemma self update # Update lemma itself
lemma self uninstall # Uninstall lemma and all toolchainsLemma stores its configuration in ~/.lemma/config.toml (or $LEMMA_HOME/config.toml).
Example configuration:
version = "1"
default_toolchain = "leanprover/lean4:stable"
path_setup_shown = true
release_url = "https://release.lean-lang.org"
[overrides]Lemma respects standard proxy environment variables:
HTTP_PROXY/http_proxy- HTTP proxy URLHTTPS_PROXY/https_proxy- HTTPS proxy URLALL_PROXY/all_proxy- Proxy for all protocolsNO_PROXY/no_proxy- Comma-separated list of domains to bypass proxyLEMMA_HOME- Lemma installation directory (default:~/.lemma)LEMMA_RELEASE_URL- Override default release serverLEMMA_TOOLCHAIN- Override active toolchain for current session
Lemma automatically detects project-specific toolchains from:
-
lean-toolchain file: Create a
lean-toolchainfile in your project root:stableor with full specification:
leanprover/lean4:v4.25.0 -
leanpkg.toml: Specify
lean_versionin your package configuration:lean_version = "v4.25.0"
Set a toolchain for a specific directory and all subdirectories:
cd my-project
lemma override set stableRemove the override:
lemma override unsetList all directory overrides:
lemma override listConfigure a custom release server in ~/.lemma/config.toml:
release_url = "https://mirror.example.com/lean-releases"Or use environment variable:
export LEMMA_RELEASE_URL=https://mirror.example.com/lean-releasesLemma resolves which toolchain to use in the following priority order:
- Explicit override:
+toolchainsyntax (e.g.,lean +nightly test.lean) - Environment variable:
LEMMA_TOOLCHAIN - Directory override: Set via
lemma override set - Project file:
lean-toolchainorleanpkg.tomlin current directory or parent directories - Default toolchain: Configured via
lemma default <toolchain>
If you see "Toolchain not installed" errors:
# List installed toolchains
lemma toolchain list
# Install the required toolchain
lemma toolchain install stableIf downloads fail behind a proxy:
# Verify proxy settings
echo $HTTPS_PROXY
# Test with curl
curl -v https://release.lean-lang.org
# Set proxy for lemma
export HTTPS_PROXY=http://your-proxy:portOn Linux/macOS, ensure lemma's bin directory is in your PATH and has execute permissions:
chmod +x ~/.lemma/bin/lemma
export PATH="$HOME/.lemma/bin:$PATH"Contributions are welcome! Key areas that need work:
- Toolchain Installation - Implement the full download and install pipeline
- Binary Proxying - Implement the toolchain binary wrapper system
- Testing - Add comprehensive test coverage
- Documentation - Expand user and developer documentation
- Platform Support - Test on Windows, macOS, Linux
- Elan - The original Lean toolchain manager that inspired this project
Note: Lemma is in early development. While the core infrastructure is in place, toolchain installation is not yet fully implemented. Use at your own risk.