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

Record the revision of a reference upon locking. Optionally also a hash over the contents. #138

Open
FRidh opened this issue Aug 18, 2020 · 4 comments · May be fixed by #140
Open

Record the revision of a reference upon locking. Optionally also a hash over the contents. #138

FRidh opened this issue Aug 18, 2020 · 4 comments · May be fixed by #140
Labels
enhancement New feature or request

Comments

@FRidh
Copy link

FRidh commented Aug 18, 2020

The lock file currently records only references. References (such as tags) are mutable, and thus the lock file does not achieve reproducibility. Upon locking the reference should be recorded (as it is now) but also the revision the reference was at at that time. Please see also the discussion at NixOS/nix#3216

Also, have a look at the following example lock file of what is recorded https://github.com/NixOS/nix/blob/master/flake.lock. narHash is essentially the hash over the contents (minus any version control files) and is used by the Nix package manager so it does not need to perform a version control checkout anymore. That I think goes a bit too far for here.

@ehmry, as maintainer of https://github.com/nix-community/flake-nimble, do you have any more input regarding the lock format?

@FRidh FRidh changed the title Record a hash over the contents and / or the revision of a reference upon locking. Record the revision of a reference upon locking. Optionally also a a hash over the contents. Aug 18, 2020
@FRidh FRidh changed the title Record the revision of a reference upon locking. Optionally also a a hash over the contents. Record the revision of a reference upon locking. Optionally also a hash over the contents. Aug 18, 2020
@disruptek
Copy link
Owner

The problem is that Nimble does not give us much to work with -- normal Nimble installations, which Nimph nominally supports, often don't even have tags or commits for us to inspect.

So, sure, we can do lockfiles using commit hashes trivially, but then Nimble will be a second-class citizen that taints lockfiles, rendering them unreproducible. If you want to submit a PR to that effect, I'm happy to merge it. Maybe a --force option will override the discovery of a Nimble package included in the lockfile?

FWIW, I really don't care what other languages or environments produce, and to me, the idea that a tag's mutability is a liability is arguably ridiculous. If you cannot trust your source to tag itself in a sane manner, maybe you should be pointing at a fork instead. It's quite trivial to do so using Nimph.

@disruptek disruptek added the enhancement New feature or request label Aug 18, 2020
@FRidh FRidh closed this as completed Aug 19, 2020
@FRidh
Copy link
Author

FRidh commented Aug 19, 2020

FWIW, I really don't care what other languages or environments produce, and to me, the idea that a tag's mutability is a liability is arguably ridiculous. If you cannot trust your source to tag itself in a sane manner, maybe you should be pointing at a fork instead.

All refs are mutable. That includes not only tags but also branches.

@disruptek disruptek reopened this Aug 19, 2020
@disruptek
Copy link
Owner

The point remains; commit hashes are immutable and are trivial for us to include in lockfiles, but again, they don’t solve the actual problem.

If you’re not interested in solving actual software development problems that real software developers have with real Nim software, then by all means, close the issue.

Nimph solves real problems.

@disruptek disruptek added this to the remove Nimble dependency milestone Aug 19, 2020
@disruptek
Copy link
Owner

Actually, I added this to the Nimble dependency milestone because I'm just going to rip Nimble support out of Nimph. It solves a number of problems and allows us to proceed with the assumption that no Nimble packages exist. This means that the lockfiles can hold hashes, as I've alluded to in every comment I've made on this issue, despite no apparent acknowledgement.

Are hashes somehow unworkable for Nix?

@disruptek disruptek linked a pull request Aug 23, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants