I’m managing a Rust project with a nix flake that uses cargo2nix
. When trying to remove an obsolete cargo workspace from the project, I get errors such as
++ crate2nix generate -f ./Cargo.toml -o Cargo-generated.nix -h /nix/store/c72g0j0b71wl0zkh4s7ms9cfy9bfbjdr-mre-crate2nix/crate-hashes.json
Error: while retrieving metadata about ./Cargo.toml: `cargo metadata` exited with an error: error: the lock file /build/8dbin39hn72h04fv5rijx35zycvqg7yk-source/Cargo.lock needs to be updated but --locked was passed to prevent this
If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.
Given that this happens deep in the bowels of cargo2nix
, I cannot follow the advice to fiddle with --locked
and --offline
flags.
How should I proceed in such situations?