forked from rust-lang/cargo
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Setup
In the ka4h2 project we use crates via git like this:
[workspace]
resolver = "3"
members = [
"crates/domain",
"crates/domain-values"
]
[workspace.package]
authors = ["slowtec GmbH <post@slowtec.de>"]
license = "AGPL-3.0-or-later"
version = "0.0.30"
edition = "2024"
rust-version = "1.89"
....
[patch.crates-io]
# Project dependencies
ka4h2-domain = { path = "crates/domain" }
ka4h2-domain-values = { path = "crates/domain-values" }
# UTBW dependencies
utbw-units = { git = "https://codeberg.org/slowtec/utbw" }
utbw-value-spec = { git = "https://codeberg.org/slowtec/utbw" }
utbw-i18n = { git = "https://codeberg.org/slowtec/utbw" }
utbw-presenter = { git = "https://codeberg.org/slowtec/utbw" }
utbw-web-components = { git = "https://codeberg.org/slowtec/utbw" }
[workspace.dependencies]
# Project dependencies
ka4h2-domain = "*"
ka4h2-domain-values = "*"
# UTBW dependencies
utbw-units = "*"
utbw-value-spec = "*"
utbw-i18n = "*"
utbw-presenter = "*"
utbw-web-components = "*"
...And cargo build added them to the Cargo.lock
[[package]]
name = "utbw-units"
version = "0.1.0"
source = "git+https://codeberg.org/slowtec/utbw#202510d2592d791a65aa7a7cc4f0dc6c17964c0d"
dependencies = [
"derive_more",
"paste",
]
[[package]]
name = "utbw-value-spec"
version = "0.1.0"
source = "git+https://codeberg.org/slowtec/utbw#202510d2592d791a65aa7a7cc4f0dc6c17964c0d"
dependencies = [
"itertools",
"proc-macro2",
"quote",
"syn",
]
Problem
But this only contains the commit hash and does not qualify the archive hash. Nix needs another hash, the sha256 and it comes from the archive. I think in nix terms the commit hash is for the user to understand what was used and the sha256 is used so the files can also be served via download of a tgz and similar.
nix-prefetch-git creates this record:
src = pkgs.fetchgit {
url = "https://codeberg.org/slowtec/utbw";
rev = "202510d2592d791a65aa7a7cc4f0dc6c17964c0d";
sha256 = "11zkhvam0nmn4mqz7sbqxfz51xm9capy03qqfy2ryx3ljih0jnrj";
};Wish
It would be nice if cargo could use https://crates.io/crates/nix-nar to also create this hash and write it to the lock file. Maybe on the other hand nix should work with only the git hash?
I don't know exactly why nix requires both, needs investigation.
Reactions are currently unavailable