RFC: specify `--packages` to lake using an environment variable
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Proposal
lake currently supports specifying a package overrides JSON file only via the --packages argument, which makes it clumsy to use lake in a wrapped way, e.g. when working in a local development environment with packages installed via Nix (as leanPackages was added recently to nixpkgs).
My proposal is to add a LAKE_PACKAGES environment variable to specify package overrides with lower precedence than --packages.
Another RFC suggests adding a separate system for handling packages installed via the system package manager. As noted in this comment in the RFC this option is not needed for building on Nix as lake already has the package overrides feature. A later PR to nixpkgs uses the --packages option to build lake packages.
I believe (and have verified to some extent, more on this later) that the user experience of setting up a development environment with LAKE_PACKAGES pointing to dependencies that have already been built is significantly better than constantly passing --packages to lake. These are the primary improvements:
- No need to make changes to the VS Code lean extension to work with a wrapped
lake --packagesas the extension fails with strange errors. - The option propagates to subprocesses that may use
lakedirectly. The wrapper argument doesn't get propagated because of the way the lean server spawns lake. If my understanding is correct, it looks for the unwrapped lake binary and sets LAKE according to that rather than using the wrapper. - Running
lake buildin the development environment just works. No need to pass--packagesor create a wrapper for that.
What I mean by "development environment" is roughly a customized set of
PATHand other environment variables. On Nix, one typically usesnix-shellto enter a development environment.
Even without this proposal, we have already achieved getting lake to not download or build any of the dependencies (after they have been cached by Nix).
Even though it sounds like it, this request is not nix-centric; other package managers and development environment setups will probably also benefit from this.
Maintainability should not be a problem as this doesn't essentially add new code branches.
Demo
I'm working on a repository to demonstrate how this feature interacts with a Nix development shell and will update it here once it's ready.
Community Feedback
There hasn't been any discussion on this yet.
Impact
Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how lake currently reads the --packages argument and how that value is passed to subprocesses. Add LAKE_PACKAGES with lower precedence than --packages, then verify that ordinary lake commands and subprocesses use the environment-provided package overrides without requiring the argument.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system, cli, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100