Skip to content

feat: CA derivations bindings (realisation + drv accessors)#2

Draft
domenkozar wants to merge 2 commits into
mainfrom
ca-derivations
Draft

feat: CA derivations bindings (realisation + drv accessors)#2
domenkozar wants to merge 2 commits into
mainfrom
ca-derivations

Conversation

@domenkozar
Copy link
Copy Markdown
Member

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 of Hercules.CNix.Store.

  • Generated.Nix.Store.Fwd (forward-declares Store once so all sibling headers reference one canonical type)
  • Generated.Nix.Store.Realisationnix_store_query_realisation, nix_realisation_free, nix_realisation_get_out_path, nix_realisation_get_signatures
  • Generated.Nix.Store.Derivation regenerated with nix_derivation_get_outputs, nix_derivation_get_input_drv_outputs, nix_derivation_has_dynamic_inputs
  • High-level wrappers: Nix.C.Store.Derivation (derivationOutputs, derivationInputDrvOutputs, derivationHasDynamicInputs) and Nix.C.Store.Realisation (queryRealisation, realisationOutPath, realisationSignatures)
  • drvFromStorePath added to Nix.C.Unsafe.Store
  • Nix.C.Hash.Nix32 + hashToNix32 restored on the canonical Hash from Nix.C.Store.PathInfo (needed by cachix to render nar/store-path hashes)

Bumps the nix flake input to cachix/nix#cachix.

Test plan

  • nix build .#nix-bindings (test suite passes)
  • Downstream cachix builds against this branch
  • cachix-server CA-derivations test (checks.x86_64-linux.ca-derivations-latest) passes — exercises the realisation push path through these bindings

🤖 Generated with Claude Code

domenkozar and others added 2 commits May 6, 2026 12:15
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>
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.

1 participant