Skip to content

Conversation

aljazerzen
Copy link

@aljazerzen aljazerzen commented Sep 1, 2025

I'm packaging rinf CLI for nixpkgs and I've noticed there is no Cargo.lock committed to git.

Changes

I'm removing Cargo.lock from .gitignore, making it a tracked file.

Why?

Having Cargo.lock in version control is the standard practice for crates that publish binaries.
It prevents build failures when downstream dependencies publish breaking changes in minor releases by mistake.

https://doc.rust-lang.org/cargo/faq.html#why-have-cargolock-in-version-control

Also, having Cargo.lock improves reproducibility of the resulting binary.

@Noah765
Copy link
Contributor

Noah765 commented Sep 1, 2025

This is a duplicate of #614

@temeddix
Copy link
Member

temeddix commented Sep 7, 2025

Hi, sorry for the late reply.

Uploading Rinf to nixpkgs sounds good. I have one question: is it possible to include the lock file only for the binary crate rinf_cli? Other crates in this repo are library crates unlike rinf_cli.

Tell me your thoughts!

@aljazerzen
Copy link
Author

This is possible, but probably more inconvenient than current situation.
So we could split rinf_cli out of the workspace (add it to workspace.exclude), which would effectively create a new workspace rinf_cli (and thus a separate Cargo.lock).

The downside is that when building the CLI, it would pull rinf the library as an external dependency and re-compile it. There would be two target/ directories and twice the compilation of dependencies.


Going with this PR's approach shouldn't have any effect on rust or dart libraries, as far as I'm aware.
The downside is only that you have additional file in the repo.
... and a bit of noise when cargo updates the lock file because you either add a new dependency.

@temeddix
Copy link
Member

temeddix commented Oct 3, 2025

Now Cargo.lock is included in rust_crate_cli by #645

Thank you very much for your participation and research!

@temeddix temeddix closed this Oct 3, 2025
@aljazerzen aljazerzen deleted the cargo-lock branch October 3, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants