nixops4 / nixops4

Deploy with Nix and manage resources declaratively
190 stars 8 forks source link

Separate raw API into crates #32

Open Radvendii opened 2 months ago

Radvendii commented 2 months ago

@roberth said there was some issue with separating the raw C API into separate crates, but I wanted to document in an issue that this is the intention.

e.g. eval_state.h and value.h should be in separate crates. Sometimes people don't need all the infrastructure for their purposes. This also allows the separate rust crates to only depend on the c functions they actually need.

roberth commented 1 month ago

Yes, the goal of the multi-crate setup is that it will be possible for a store-only program to only use the libstore part of Nix. Currently we're running into a limitation with bindgen that forces us to use a single crate for the generated bindings; specifically bindgen would generate a whole new set of types, etc, for libutil when generating libstore, or for libutil and libstore when generating libexpr. This isn't just wasteful, but also causes those equivalent types to be incompatible, as the compiler sees distinct nominal types for the same things.