feat: CA derivations bindings (realisation + drv accessors)#2
Draft
domenkozar wants to merge 2 commits into
Draft
feat: CA derivations bindings (realisation + drv accessors)#2domenkozar wants to merge 2 commits into
domenkozar wants to merge 2 commits into
Conversation
Bumps the nix flake input to cachix/nix#cachix, which combines the
existing path-info-json work with the new realisation and structured
derivation accessor C API additions.
C API additions surfaced:
- nix_api_store/fwd.h -> Generated.Nix.Store.Fwd
(canonical Store opaque type)
- nix_api_store/realisation.h -> Generated.Nix.Store.Realisation
(query_realisation + accessors)
- nix_api_store/derivation.h regenerated with
get_outputs / get_input_drv_outputs /
has_dynamic_inputs
The bindgen generator now processes fwd.h first so every store-related
header references one canonical Store type instead of each module
declaring its own.
High-level wrappers (nix-bindings):
- Nix.C.Store.Derivation: derivationOutputs,
derivationInputDrvOutputs, derivationHasDynamicInputs
- Nix.C.Store.Realisation: queryRealisation, realisationOutPath,
realisationSignatures
- Nix.C.Unsafe.Store: drvFromStorePath
- Nix.C.Internal: Derivation/Realisation handle types
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The cachix client serializes nar hashes and store-path hashes in Nix's <algo>:<nix32> format, which an earlier nix-bindings revision exposed via Nix.C.Hash / Nix.C.Hash.Nix32. The current Hash type lives on Nix.C.Store.PathInfo and only had hashToSRI, so add the nix32 encoder back as Nix.C.Hash.Nix32 and a hashToNix32 method alongside hashToSRI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
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
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.
Summary
Adds Haskell bindings for the new C API surface introduced on
cachix/nix#cachix(path-info-json + realisation + structured derivation accessors), so that cachix can push CA-derivation realisations through the C FFI instead ofHercules.CNix.Store.Generated.Nix.Store.Fwd(forward-declaresStoreonce so all sibling headers reference one canonical type)Generated.Nix.Store.Realisation—nix_store_query_realisation,nix_realisation_free,nix_realisation_get_out_path,nix_realisation_get_signaturesGenerated.Nix.Store.Derivationregenerated withnix_derivation_get_outputs,nix_derivation_get_input_drv_outputs,nix_derivation_has_dynamic_inputsNix.C.Store.Derivation(derivationOutputs, derivationInputDrvOutputs, derivationHasDynamicInputs) andNix.C.Store.Realisation(queryRealisation, realisationOutPath, realisationSignatures)drvFromStorePathadded toNix.C.Unsafe.StoreNix.C.Hash.Nix32+hashToNix32restored on the canonicalHashfromNix.C.Store.PathInfo(needed by cachix to render nar/store-path hashes)Bumps the
nixflake input tocachix/nix#cachix.Test plan
nix build .#nix-bindings(test suite passes)checks.x86_64-linux.ca-derivations-latest) passes — exercises the realisation push path through these bindings🤖 Generated with Claude Code