leanprover / leanprover/lean4

RFC: lake build: add `--system-packages` flag to use system package manager

Open
#5,122 11 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Lake P-low RFC
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Proposal

In order for lean libraries to be packaged for Linux distributions, they must be installable using the system package manager. The system package manager will use lake build for building individual projects, but will manage the dependencies without lake. There should be a way for lake build to either:

  1. build the project without considering dependencies (and assume they will be made available at runtime using $LEAN_PATH or some other method)
  2. specify one or more package directories on the command-line for lake to use at build-time

Notes:

  • The exact implementation (flag vs. environment variable, how to specify multiple paths, etc.) is not important, system package managers are flexible there.
  • Patching lakefile.lean/toml manually for each library is not feasible.
  • Fetching any information at build time from a remote endpoint (like the reservoir registry) or via git fetch is also not OK for reproducible package managers like Nix or Guix.
  • Ideally lake would be able to link directly against compiled .olean/.lean files, and not require the original code or lakefile.lean for dependencies. Not a big deal if this isn't possible.
Community Feedback

The system package manager problem was mentioned here, although the issue itself was for a different idea:
https://github.com/leanprover/lean4/issues/3193#issuecomment-1898009228

Impact

The impact would be availability of Lean libraries on various Linux distributions.

I have Lean 4.10, batteries, and some other libraries packaged for Guix via a new lean-build-system. But I cannot package mathlib because lake keeps trying to git fetch the dependencies.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the lake build entry point and the dependency behavior described for system package managers, including the existing lakefile.lean/toml configuration and git fetch path. Done means projects can build with externally supplied package directories or without dependency fetching, without manually patching lakefiles or contacting remote endpoints.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.