Parses, validates, hashes, and serializes Nix derivations and constructs their store paths in pure Rust
Disclaimer: LLMs have been used
Parses, validates, hashes, and serializes Nix derivations and constructs their store paths in pure Rust
Disclaimer: LLMs have been used
Nix master has recently landed changes that create a separation between the low-level representation and a more high level representation.
It means that consumers of the new types can focus on the meaning rather than how that maps to the current 20+ year old format that’s been layered on top of.
Output hashing modulo meta will fit nicely on top of those (rebase incoming). I know you’ll like that one ![]()
Most notable refactor I think is libstore: compute the hash modulo via an intermediate derivation by amaanq · Pull Request #16191 · NixOS/nix · GitHub
I suppose your library is only slightly above the ATerm level?
That’s already good enough for most applications, including extracting the meta field, but if you want to also write derivations, the extra layering becomes useful.
Hey Robert,
Thanks for chipping in!
I’ve opened Align derivation modulo hashing with Nix master by domenkozar · Pull Request #1 · cachix/nix-derivation · GitHub to catch up!
This one makes my day
What kind of help do you need to get it merged?
Draft PR for nix-derivation: Add proposed derivation metadata semantics by domenkozar · Pull Request #2 · cachix/nix-derivation · GitHub
Your “slightly above the ATerm level” characterization was fair for 0.1. It had semantic output types, but serialization and hashing still shared the low-level representation through a boolean masking mode. Should be fixed now in #1.
I’ve released nix-derivation 0.2 with these changes, more performance tuning and overall cleaning up of the interface.
nix-derivation 0.3 released with custom store prefix support such as /gnu/store
nix-derivation 0.4.0 adds support for Nix 2.35 dynamic derivations: