Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
a2379 opened this issue Aug 22, 2024 · 8 comments
Open
Labels
Lake Lake related issue P-low We are not planning to work on this issue RFC Request for comments

Comments

@a2379
Copy link

a2379 commented Aug 22, 2024

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:
#3193 (comment)

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.

@a2379 a2379 added the RFC Request for comments label Aug 22, 2024
@a2379 a2379 changed the title RFC: lake build: add --system-packages flag to use system package manager RFC: lake build: add --system-packages flag to use system package manager Aug 22, 2024
@leanprover-bot leanprover-bot added the P-low We are not planning to work on this issue label Aug 23, 2024
@tydeu tydeu added the Lake Lake related issue label Aug 24, 2024
@Coda-Coda
Copy link

This sounds like a good idea to me! 😃

Coda-Coda pushed a commit to Coda-Coda/Nethermind-Clear that referenced this issue Oct 7, 2024
The idea is that `elan` should be used to install `lean` rather than directly using Nix, because of issues with packaging `mathlib` such as discussed here: leanprover/lean4#5122.
Based on `nix flake init -t templates#utils-generic`.
Coda-Coda pushed a commit to NethermindEth/Clear that referenced this issue Oct 7, 2024
The idea is that `elan` should be used to install `lean` rather than directly using Nix, because of issues with packaging `mathlib` such as discussed here: leanprover/lean4#5122.
Based on `nix flake init -t templates#utils-generic`.
Coda-Coda pushed a commit to Coda-Coda/Nethermind-Clear that referenced this issue Oct 8, 2024
The idea is that `elan` should be used to install `lean` rather than directly using Nix, because of issues with packaging `mathlib` such as discussed here: leanprover/lean4#5122.
Based on `nix flake init -t templates#utils-generic`.
Coda-Coda pushed a commit to NethermindEth/Clear that referenced this issue Oct 9, 2024
The idea is that `elan` should be used to install `lean` rather than directly using Nix, because of issues with packaging `mathlib` such as discussed here: leanprover/lean4#5122.
Based on `nix flake init -t templates#utils-generic`.
Coda-Coda pushed a commit to NethermindEth/Clear that referenced this issue Oct 11, 2024
The idea is that `elan` should be used to install `lean` rather than directly using Nix, because of issues with packaging `mathlib` such as discussed here: leanprover/lean4#5122.
@divyaranjan1905
Copy link

divyaranjan1905 commented Nov 29, 2024

Hello @Coda-Coda @a2379 , has this been fixed?

@hargoniX
Copy link
Contributor

No, it is also currently not recommended to package Lean with a system package manager as libraries currently rely on very specific releases and are often not forward or backward compatible. For example if you install Lean version 4.x and then work on a mathlib checkout that relies on 4.y you are just going to get lots of weird errors.

@divyaranjan1905
Copy link

No, it is also currently not recommended to package Lean with a system package manager as libraries currently rely on very specific releases and are often not forward or backward compatible. For example if you install Lean version 4.x and then work on a mathlib checkout that relies on 4.y you are just going to get lots of weird errors.

I see, that makes sense, but in a transactional package management/distribution setting like Guix or Nix, the curl method doesn't work because it demands write access to read-only directories such as ~/.profile.

@a2379
Copy link
Author

a2379 commented Dec 1, 2024

No, it is also currently not recommended to package Lean with a system package manager as libraries currently rely on very specific releases and are often not forward or backward compatible. For example if you install Lean version 4.x and then work on a mathlib checkout that relies on 4.y you are just going to get lots of weird errors.

Sure, but that is not what the original issue is referencing. Lake should support installing both Lean and Lean libraries through the system package manager. Version mismatches would not be an issue, because package maintainers are used to updating programs and their dependencies in lockstep.

@divyaranjan1905
Copy link

@hargoniX and other maintainers, at least you might guide us on how this might be implemented in a PR? Because without this, mathlib et.al simply would be unusable in distros such as Guix.

@nomeata
Copy link
Collaborator

nomeata commented Dec 7, 2024

I believe there is on the roadmap the ability to vendor the dependencies, and then build without network access. This would presumably already help a bunch for your use case? (Can't comment on timelines or precise form of the feature.)

@divyaranjan1905
Copy link

I believe there is on the roadmap the ability to vendor the dependencies, and then build without network access.

Indeed, that would be all we need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lake Lake related issue P-low We are not planning to work on this issue RFC Request for comments
Projects
None yet
Development

No branches or pull requests

7 participants