-
Notifications
You must be signed in to change notification settings - Fork 103
Update flake inputs #414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jrobsonchase
wants to merge
11
commits into
nix-community:master
Choose a base branch
from
jrobsonchase:update-flake-inputs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Update flake inputs #414
jrobsonchase
wants to merge
11
commits into
nix-community:master
from
jrobsonchase:update-flake-inputs
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Crate2nix identifies packages using package ID strings reported by the `cargo metadata` subcommand. Cargo describes these strings as internal identifiers subject to change. And in fact the string format did change sometime between cargo 1.76 and cargo 1.78. In cargo 1.76 package ID strings look like this: ``` aho-corasick 1.1.3 (registry+https://github.com/rust-lang/crates.io-index) ``` In later cargo versions the format changed to look like this: ``` registry+https://github.com/rust-lang/crates.io-index#aho-corasick@1.1.3 ``` The change is fine as long as package IDs are used as opaque identifiers in memory. Unfortunately one use of package IDs is to look up checksums in the legacy v1 `Cargo.lock` manifest format. That format stores checksums in a map at the end of the file that looks like this: ```toml [metadata] "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" ``` Being a legacy format the keys in these checksum maps will always use the old package ID format. The problem becomes quickly apparent because nix-test-runner - which is used in the crate2nix test suite - happens to use a v1 manifest. That leads to tests and the devShell breaking when attempting to update crate2nix flake inputs. Currently crate2nix assumes that package IDs read from `cargo metadata` output can be used as lookup keys in the v1 checksum map. But when a recent version of cargo is installed that assumption is broken. This PR fixes the problem by constructing checksum lookup keys explicitly. This should make checksum lookups work regardless of which cargo version is installed.
jrobsonchase
commented
Dec 23, 2025
Comment on lines
+5
to
+9
| { system | ||
| , pkgs ? import | ||
| "${builtins.fetchTree (builtins.getAttr flakeLock.nodes.crate2nix_stable.inputs.nixpkgs flakeLock.nodes) | ||
| .locked}" | ||
| { inherit system; } |
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first point where I noticed the new nixpkgs causing problems. It wasn't enough to use the stable crate2nix - it had to be the stable crate2nix with the same nixpkgs to get this working.
1ed36bc to
1fd04a7
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Builds on #413 and #381.
Run a
nix flake updateand fix problems that arise.