restate: cargoHash produces different hashes on each build
Problem
cargoHash produces different hashes on each build for restate package.
Error
error: hash mismatch in fixed-output derivation '/nix/store/jzaw2z3hf0cvdhxwwwf6j90gwg7qvsa5-restate-1.6.2-vendor-staging.drv':
specified: sha256-LfLqScEqBJK9s+xRg2Ah1OnBEDQjXQ9LgJGusmxEDfk=
got: sha256-VrxoxygLkw+77ORgFnFmIVY4CRVgWevWkiFcYxiPkpw=
Cause
restate has git dependencies with submodules. nix-prefetch-git --fetch-submodules fetches them non-deterministically, causing hash mismatches.
Git Dependencies
- base62-2.2.3
- raft-0.7.0, raft-proto-0.7.0
- rdkafka-0.38.0, rdkafka-sys-4.9.0+2.12.1
- restate-web-ui-0.1.49
- rust-librocksdb-sys-0.41.0+10.9.1, rust-rocksdb-0.45.0
- sasl2-sys-0.1.22+2.1.28
nix-prefetch-git --fetch-submodules fetches them non-deterministically, causing hash mismatches
What do you mean non-deterministically? Do you have a diff of what is actually not deterministic? Is there any open issue wrt nix-prefetch-git?
#524430 and #525255 seems relevant
- Basically as https://github.com/NixOS/nixpkgs/issues/100498#issuecomment-1846499310 mentions, dropping the
.gitwould be the easiest way to ensure determinism. Odd that that's not the default.
Can we not do the AI slop posting? Thanks.
https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#automationai-policy
#524430 only disabled maintenance for the main repo. Submodule clones still spawn background maintenance, which races with rm -rf .git and breaks hash determinism.
Workaround: depsExtraArgs = { GIT_CONFIG_COUNT = "1"; GIT_CONFIG_KEY_0 = "maintenance.auto"; GIT_CONFIG_VALUE_0 = "false"; }; — this makes cargoHash stable again.
Closing #525262. The real fix belongs in nix-prefetch-git.