Skip to content

Make both name/version take precedence if in [workspace.metadata.crane] - #1099

Merged
ipetkov merged 1 commit into
ipetkov:masterfrom
shielded-nate:explicit-nix-package
Nov 4, 2026
Merged

ipetkov merged 1 commit into
ipetkov:masterfrom
shielded-nate:explicit-nix-package

Conversation

@shielded-nate

Copy link
Copy Markdown
Contributor

If either name or version are present in Cargo.toml 's [workspace.metadata.crane] section, these define the nix package metadata. If either is not present, other existing fallback alternatives are consulted.

This also changes the implementation of [workspace.metadata.crane.name] precedence in a way that matches the doc comment, whereas prior to this change the comment and implementation diverged.

Motivation

If this metadata section is present, it's specific to nix (and crane), so it is incoherent for the nix build to use different values for these in its derived package.

Additionally, adding support for version is necessary for many rust workspaces where different crates have different versions, so none of the fallbacks can be coherent.

Checklist

  • added tests to verify new behavior
  • added an example template or updated an existing one
  • updated docs/API.md (or general documentation) with changes
  • updated CHANGELOG.md

…ves.

# Rationale

If this metadata section is present, it's specific to nix (and crane), so it is incoherent for the `nix` build to use _different_ values for these in its derived pacakge. Additionally, adding support for `version` is necessary for many rust workspaces where different crates have different versions, and none should be automatically prioritized for the nix derivation.
@ipetkov

ipetkov commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix!

@ipetkov
ipetkov enabled auto-merge (squash) November 4, 2026 23:52
@ipetkov
ipetkov disabled auto-merge November 4, 2026 23:56
@ipetkov
ipetkov merged commit 79fd635 into ipetkov:master Nov 4, 2026
20 checks passed

This branch was previously deployed

1 inactive deployment
cachix — 0bdd71e1 Deployed Nov 4, 2026 by shielded-nate via build examples (cross-windows) #1840
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.

2 participants