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

treewide: switch to cargoHash #327127

Merged
merged 5 commits into from
Jul 15, 2024
Merged

Conversation

Aleksanaa
Copy link
Member

@Aleksanaa Aleksanaa commented Jul 14, 2024

Description of changes

No need (observed) for these packages to have a vendor Cargo.lock. If they for some reason have to use a different Cargo.lock than upstream, they should copy that to the build directory as well, otherwise the build will fail. They don't, so I infer there's no reason to use Cargo.lock.

Related #327063

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@emilazy
Copy link
Member

emilazy commented Jul 14, 2024

I think we could quite tractably automate this treewide: hook into postPatch, output a hash of the Cargo.lock file, and compare against the Cargo.lock in‐tree?

@jopejoe1
Copy link
Member

jopejoe1 commented Jul 14, 2024

Looking at the history of some of them shows that they had git dependency's at some point but did not switch away from vendoring Cargo.lock files after those where no longer included.

@minijackson
Copy link
Member

I don't mind either way for my package, but shouldn't we wait for consensus on #327063 before?

@Aleksanaa
Copy link
Member Author

I don't mind either way for my package, but shouldn't we wait for consensus on #327063 before?

I believe we've never made consensus on "regular rust packages should also use Cargo.lock" (no git dependencies, no cargo lock hacks), it is always considered as an anti-pattern

@minijackson
Copy link
Member

Was it always? For a while I thought cargoHash was the anti-pattern, due to the reasons I mentioned in #327063

@Aleksanaa
Copy link
Member Author

Aleksanaa commented Jul 14, 2024

Was it always? For a while I thought cargoHash was the anti-pattern, due to the reasons I mentioned in #327063

https://nixos.org/manual/nixpkgs/unstable/#rust

As the documentation shows, using cargoHash is the recommended way. It however mentioned two kinds of situations where cargoLock should be used: 1. in a project itself 2. contains git hashes.

@Aleksanaa Aleksanaa closed this Jul 14, 2024
@Aleksanaa Aleksanaa reopened this Jul 14, 2024
@Mic92
Copy link
Member

Mic92 commented Jul 14, 2024

Was it always?

Yes. Otherwise we would have replaced all cargo hashes already. The size of the lock files was always a concern.

Copy link
Member

@felschr felschr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As maintainer for nickel, I'm good with the change. Similar to the other cases, it was only introduced due to git dependencies upstream which aren't required anymore:
https://github.com/NixOS/nixpkgs/pull/255266/files#r1327205689

@minijackson
Copy link
Member

Welp, I might have given to much importance to some random messages on the Nixpkgs issue tracker, then. But if that's the case, I do think it's worth updating the documentation. I do see cargoHash being presented first, but nowhere do I see it being explicitly recommended over lockFile in nixpkgs. Even after re-reading it, I just see the documentation presenting two ways of doing things, each with their pros and cons.

@Mic92
Copy link
Member

Mic92 commented Jul 14, 2024

Welp, I might have given to much importance to some random messages on the Nixpkgs issue tracker, then. But if that's the case, I do think it's worth updating the documentation.

Be my guest.

@ofborg ofborg bot requested a review from felschr July 14, 2024 17:54
@wegank wegank added 12.approvals: 1 This PR was reviewed and approved by one reputable person 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package labels Jul 15, 2024
@Aleksanaa Aleksanaa added 12.approvals: 2 This PR was reviewed and approved by two reputable people and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Jul 15, 2024
@Artturin Artturin merged commit d582f13 into NixOS:master Jul 15, 2024
40 of 42 checks passed
@Aleksanaa Aleksanaa mentioned this pull request Jul 16, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: vim 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 12.approvals: 2 This PR was reviewed and approved by two reputable people 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants