-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Hash modulo meta #14686
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
base: master
Are you sure you want to change the base?
Hash modulo meta #14686
Conversation
e7c3b2d to
846a9c9
Compare
Make the meta field optional in DerivationOptions JSON deserialization to maintain backward compatibility with JSON that predates the derivation-meta feature. Changes: - Use optionalValueAt instead of valueAt for meta field deserialization - Mark meta as optional in derivation-options-v1 schema - Add unit test for backward compatibility
When the derivation-meta experimental feature is enabled, extract the __meta field from structuredAttrs to a top-level meta field in the Derivation JSON format (used by `nix derivation show/add`). This makes the format consistent with DerivationOptions JSON and provides better visibility of metadata without it being buried in structuredAttrs. The implementation: - Creates derivationToJson() helper accepting ExperimentalFeatureSettings - Extracts __meta to top-level meta field when feature is enabled - Requires experimental feature when deserializing JSON with meta field - Reconstructs __meta in structuredAttrs during deserialization - Maintains backward compatibility with JSON lacking meta field Tests verify both serialization and deserialization with mocked experimental feature settings, and functional tests ensure the experimental feature requirement is enforced.
846a9c9 to
b2c772b
Compare
|
I didn't see this mentioned explicitly, but I assume It's not entirely obvious how derivation meta data would be used in practice, especially since derivers are kind of useless (e.g. cache.nixos.org paths do have a deriver, but you have no way to get to them, so you wouldn't be able to get to the metadata). Perhaps in conjunction with #11749, the metadata could be propagated into the provenance records of store paths (which are already JSON). |
Correct, and this is now also covered by a functional test.
You can instantiate your stuff and inspect the metadata.
So this is a good step towards making #11749 more effective.
|
Motivation
metais lost at the derivation level, but it doesn't need to be that way, thanks to quotient hashing aka hash modulo.This change makes use of the existing "discrepancy" between derivation hashes and output hashes to allow more information to be stored in derivations without causing rebuilds.
The core of the change is fairly simple; see the
hashDerivationModulohunk.Changes
derivation-metaimproving hash quotient logic to support storingmetametaa first class top level attr instead of the ATerm embeddingNotes
Example
Context
meta.timeoutAdd 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.