https://discord.com/channels/568306982717751326/1073823970467524770
I’m trying to package filips123/PWAsForFirefox, which is a Rust binary (sources in native
subdir).
The project relies on unpublished forks of two crates: data-url
and mime
. There is a third, written by filips123: web_app_manifest
. All three of these are specified as Git dependencies in the Cargo.toml
.
For example,
data-url = { git = "https://github.com/filips123/rust-url", branch = "impl-std-error" }
I’ve been reading:
https://github.com/NixOS/nixpkgs/blob/b71a0e4f1bcb92ac7a50f82d33bec7a9451b2a18/doc/languages-frameworks/rust.section.md
I’ve added:
cargoLock = {
lockFile = "${source}/native/Cargo.lock";
# allowBuiltinFetchGit = true;
outputHashes = {
"data-url-0.1.0" = "sha256-rESQz5jjNpVfIuTaRCAV2TLeUs09lOaLZVACsb/3Adg=";
"web_app_manifest-0.0.0" = "sha256-CpND9SxPwFmXe6fINrvd/7+HHzESh/O4GMJzaKQIjc8=";
"mime-0.4.0-a.0" = "sha256-LjM7LH6rL3moCKxVsA+RUL9lfnvY31IrqHa9pDIAZNE=";
};
};
When building the package, Cargo has an error because it decides the lock file is out-of-date:
> error: the lock file /build/native/Cargo.lock needs to be updated but --frozen was passed to prevent this
> If you want to try to generate the lock file without accessing the network, remove the --frozen flag and use --offline instead.
I see this, which indicates it has passed Nix’s check:
> Validating consistency between /build/native/Cargo.lock and /build/cargo-vendor-dir/Cargo.lock
I’ve built the package manually, online, and the lock file for the release I’m packaging is indeed correct and does not need to be updated.
When Cargo builds offline, it can’t clone the git dependencies. That isn’t even to mention that allowBuiltinFetchGit = false
presumably has another mechanism outside --frozen
to prevent this.
How do I provide the requisite Git dependencies to Cargo? Can I package them individually and add them to nativeBuildInputs
? I would really rather not.