Prefer rich over generic platforms when host capabilities match
Problem description
When declaring both a generic platform (e.g. linux-64) and a rich custom platform (e.g. { name = "gpu-linux-64", platform = "linux-64", cuda = "13.0" }), the selection logic currently determines candidate precedence strictly based on declaration order in the platforms array, as documented in https://github.com/prefix-dev/pixi/blob/b9ae7bff6555e3db6509dac0c9439cb85cbcb0f8/crates/pixi_manifest/src/workspace.rs#L153-L155.
I believe users would be less surprised if the richest platform were preferred, especially when matching __cuda (see e.g. https://github.com/prefix-dev/pixi/issues/6626 fyi @anthonyylee).
Possible solutions could be:
- sort candidates by specificity within the same base arch (e.g. linux-64)
- fallback to declaration order for platforms with equal specificity
- document this prominently or print a warning/hint when multiple candidates match the host
I'd love to hear what the maintainers think about this. I'd be happy to possibly open a PR
Source: prefix-dev/pixi