-
Notifications
You must be signed in to change notification settings - Fork 441
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
Nix builds have empty githash #4015
Comments
Just adding the git hash here would defeat most of benefits of using nix, such as a cache hit if you build identical sources. I'd propose to implement it differently: a nix'ed lean binary ought to look in its own nix store path, and use the nix hash therein as the “githash”. This should have the uniqueness guarantees lake wants, without causing unnecessary rebuilds. Happy to review a PR |
I think this is not an option because |
What is “this” you are referring to? You only quote the first sentence, but that’s not what I am proposing. What is the correctness requirement for the githash value? Is the following sound: “If the sources that were used to built the So if the |
How would you have identical sources if the git hash is different? I'm probably misunderstanding this sentence.
The mathlib cached .olean files have a hash that is derived from the git hash of lean that was used to build them. If we were to use some nix hash as the "git hash", users of lean installed with nix would never be able to use the mathlib cache. This nix-hash lean would request files with a hash that do not exist in the remote cache. Additionally, flakes expose the git hash used to build them through |
or some form of rebasing.
Yes, that’s what I would expect: It’s a different build of
Right, but that’s dangerous. Imagine someone using such a flake, but then applies a patch using |
Fair enough, I think this is enough rationale not to pursue adding the git hash like I proposed. Since nix installs are not technically supported, nix users can patch in the git hash if they wish. |
Ah, I missed that the primary motivation was compatibility with mathlib’s cache (as opposed to, say, For the reasons above I am hesitant to make nix builds out of the box pretend that they equivalent to some particular release build. Does setting |
Is |
It is a |
Yeah that would simplify using the cache through a nix install. The devshell could then export I think we just need to change this line to have |
Exactly. (Maybe a bit more robust to use a wrapper around the |
Yeah but I think the mathlib cache code runs lake (and lean) through |
It is important that |
Doesn't lean adhere to |
The Nix build has been officially deprecated #4895 |
Was there any Zulip discussion on deprecating the Nix build? |
Only in so far that a few questions about the nix setup were responded to by saying that it's unfortunately unsupported and users are on their own. I do hope that someone will pick it up and continue to maintain a nix setup for lean, albeit in a separate repository. |
Prerequisites
Description
When installing
lean4
via a flake, it's version string does not contain a git sha1 hash. When hashing lean files (for downloading mathlib's cache), these hashes depend on the git commit hash. Thus using the mathlib cache fails when using a lean/lake through nix.Proposed Solution
I wanted to open a PR immediately but did not do so since the guidelines request an issue is opened first. I have a patch here that adds the git hash into
CMakeLists.txt
before building. There is some precedence for this.Context
Here is a Zulip discussion and an investigation of the issue.
Steps to Reproduce
When installing
lean4
via its nix flake, it's version string does not contain a git sha1 hash. For example, entering a devshell with thisflake.nix
fileand running
lean --version
produces:Notice there is no commit in the version.
Expected Behavior
A properly built lean binary outputs the following:
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: