Skip to content

Error when using a git dependency that includes a workspace, when the flake is also in a workspace #310

Open
@jelle-bigbridge

Description

@jelle-bigbridge

I don't know if my attempt at a short title makes sense, but I'm encountering a bug with the following setup:

  • My repository has a workspace with multiple packages
  • The workspace depends on sqlx via git (it points to my personal fork of sqlx)
  • I build one of those packages in my flake via naersk

Naersk errors with the following log:

https://cache.nixos.org/jdj7x0j6nqfwwbxdi7817jp6c8q8pb06.narinfo
unpacking sources
unpacking source archive /nix/store/7j4556lxs9rjb0zblkkb0f6j40mmhv20-dummy-src
source root is dummy-src
patching sources
configuring
[naersk] cargo_version (read): 1.71.1 (7f1d04c00 2023-07-29)
[naersk] cargo_message_format (set): json-diagnostic-rendered-ansi
[naersk] cargo_release: --profile release-server
[naersk] cargo_options:
[naersk] cargo_build_options: $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format --package bibs-server
[naersk] cargo_test_options: $cargo_release -j "$NIX_BUILD_CORES" --package bibs-server
[naersk] RUST_TEST_THREADS: 8
[naersk] cargo_bins_jq_filter: .
[naersk] cargo_build_output_json (created): /build/tmp.P8anP0GEYc
[naersk] RUSTFLAGS:
[naersk] CARGO_BUILD_RUSTFLAGS:
[naersk] CARGO_BUILD_RUSTFLAGS (updated):  --remap-path-prefix /nix/store/qfyhwwg326nr5vxg1p5av2ic7c4qikld-crates-io-dependencies=/sources --remap-path-prefix /nix/store/kdhdx724l1xxwn2740s2xac2qkywaxyj-git-dependencies=/sources
building
cargo build $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format --package bibs-server
error: failed to get `sqlx` as a dependency of package `bibs-server v0.1.0 (/build/dummy-src/bibs-server)`

Caused by:
  failed to load source for dependency `sqlx`

Caused by:
  Unable to update https://github.com/jelle-bigbridge/sqlx.git?branch=add-local-infile#9b9b8c41

Caused by:
  failed to update replaced source https://github.com/jelle-bigbridge/sqlx.git?branch=add-local-infile#9b9b8c41

Caused by:
  failed to parse manifest at `/nix/store/kdhdx724l1xxwn2740s2xac2qkywaxyj-git-dependencies/sqlx-macros-0.7.1-add-local-infile/Cargo.toml`

Caused by:
  error inheriting `version` from workspace root manifest's `workspace.package.version`

Caused by:
  failed to find a workspace root
[naersk] cargo returned with exit code 101, exiting

I hope that my PR with sqlx is merged soon and they will release a crates.io crate with my fix, but until then my code will have to depend on my own fork. I don't know if this is easily fixed or not, at least a workaround would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions