NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.04k stars 13.38k forks source link

`cargoHash` might be different on linux and darwin systems #308089

Open jian-lin opened 3 months ago

jian-lin commented 3 months ago

Describe the bug

The cargoHash might be different on linux and darwin systems. I know that kanata, atuin and trunk-ng have this problem. There are more affected packages.

This problem seems to be caused by the case sensitivity of file systems.

Additional context

Notify maintainers

@NixOS/rust


Add a :+1: reaction to issues you find important.

SuperSandro2000 commented 3 months ago

buildGoModule solves a similar problem

That is an upstream feature of go and nothing nixpkgs implements.

uri-canva commented 3 months ago

Note that unless cargo can resolve dependencies differently across OSs (some package managers can switch dependencies based on build os, i don't know of any that can do it based on target os, but I assume there might be, and cargo might be one of them), and the dependencies only contain source code and not outputs / intermediates, then the hashes should always be the same, and any discrepancies are likely to be due to file system case sensitivity issues, bugs in os specific code paths in cargo itself, stuff like that.

Unfortunately I don't know enough about cargo and its ecosystem to say for sure, but wanted to raise it since similar issues pop up in the maintenance of darwin support of other packages in nixpkgs, like the bazel related ones.

nixos-discourse commented 1 month ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/cargo-lock-considered-harmful/49047/3

jian-lin commented 1 week ago

Two related upstream issues are added.