diff options
author | Lily Foster <lily@lily.flowers> | 2023-12-21 19:40:43 -0500 |
---|---|---|
committer | Lily Foster <lily@lily.flowers> | 2023-12-21 19:40:43 -0500 |
commit | 5a8c65e118c36697efb1fcec3093d915dd68a8ff (patch) | |
tree | 743ecf7063b4e33df0066acdcef6328251f135ee /pkgs/build-support/rust | |
parent | 54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6 (diff) |
rustPlatform.importCargoLock: fix workspace_root detection
Prior to this change, the `importCargoLock` git dependency builder assumed that the workspace root that needed to be passed to `replace-workspace-values` will always be the root directory of the git repository. This is not always the case as independent workspace roots may be used from subdirectories, and packages be referenced via paths. An example of this is [1], where the `iced` subdirectory is its own independent workspace, and workspace values for packages within it should be pulled from the `iced` subdirectory as the workspace root, not from the top-level of the fetched repository. [1]: https://github.com/pop-os/libcosmic/blob/b8f1a366dd030b90ed72e50f521e3da1d6a676ce/Cargo.toml
Diffstat (limited to 'pkgs/build-support/rust')
-rw-r--r-- | pkgs/build-support/rust/import-cargo-lock.nix | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/build-support/rust/import-cargo-lock.nix b/pkgs/build-support/rust/import-cargo-lock.nix index c17b0e41cca8e..e3fe57ef06daa 100644 --- a/pkgs/build-support/rust/import-cargo-lock.nix +++ b/pkgs/build-support/rust/import-cargo-lock.nix @@ -193,7 +193,7 @@ let if grep -q workspace "$out/Cargo.toml"; then chmod u+w "$out/Cargo.toml" - ${replaceWorkspaceValues} "$out/Cargo.toml" "${tree}/Cargo.toml" + ${replaceWorkspaceValues} "$out/Cargo.toml" "$(${cargo}/bin/cargo metadata --format-version 1 --no-deps --manifest-path $crateCargoTOML | ${jq}/bin/jq -r .workspace_root)/Cargo.toml" fi # Cargo is happy with empty metadata. |