Skip to content

fix wild cards and subcrates#394

Merged
domenkozar merged 1 commit intonix-community:masterfrom
Pacman99:fix-subcrates
Jan 28, 2026
Merged

fix wild cards and subcrates#394
domenkozar merged 1 commit intonix-community:masterfrom
Pacman99:fix-subcrates

Conversation

@Pacman99
Copy link
Contributor

@Pacman99 Pacman99 commented Mar 14, 2025

This solves a couple issues with crate2nix not matching expected cargo behavior. Fixes #387 and another issue where crates are located in subpaths of a git repository with no root cargo.toml. The second issue can be seen in https://github.com/strangelove-ventures/interchaintest where there is a rust crate located in local-interchain/rust/localic-std and no root Cargo.toml.

Both issues can be fixed by making a list of all cargo.toml in the repo and checking to see if any of them match the expected name of the package in the workspace. This is possible because of a nixpkgs function lib.filesystem.listFilesRecursive. This method seems pretty robust, since it follows the same logic that cargo itself follows when finding packages in a git repository as explained here rust-lang/cargo#1462 (comment).

@Pacman99 Pacman99 force-pushed the fix-subcrates branch 2 times, most recently from cb61181 to 1f3854e Compare March 14, 2025 21:43
@domenkozar
Copy link
Contributor

Can we have a test?

@domenkozar domenkozar merged commit c726e52 into nix-community:master Jan 28, 2026
2 checks passed
domenkozar added a commit that referenced this pull request Jan 28, 2026
Add changelog entry documenting the fix for git dependencies with
wildcard workspace members and subcrates in nested directories.

Add sub_dir_crates_ifd test that exercises the IFD code path in
tools.nix to verify the fix works when dynamically generating Cargo.nix.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wildcard in workspace.members causes evaluation error

3 participants