Skip to content

Add nix_store_build_paths to libstore-c#15352

Open
RossComputerGuy wants to merge 1 commit intoNixOS:masterfrom
DeterminateSystems:upstream-capi-build-paths
Open

Add nix_store_build_paths to libstore-c#15352
RossComputerGuy wants to merge 1 commit intoNixOS:masterfrom
DeterminateSystems:upstream-capi-build-paths

Conversation

@RossComputerGuy
Copy link
Member

Motivation

Provides a more flexible way to build paths, nix_store_build_paths can take opaque paths. That means they're not a .drv file, that makes this useful for fetching paths which have no .drv associated with it.

Context

Upstream nix_store_build_paths from DeterminateSystems#210 & sliced out of #14031


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@github-actions github-actions bot added the c api Nix as a C library with a stable interface label Feb 26, 2026
Comment on lines 187 to 188
nix::to_json(json, result);
callback(userdata, result.path.to_string(store->ptr->config).c_str(), json.dump().c_str());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to operate on arbitrary json? Seems like we need a C API counterpart of the build result.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we would, we've always done JSON for this sort of thing afaik. I forget the exact reasoning but at least when I've worked with this through nixops4/nix-bindings-rust, having arbitrary JSON has made binding from Rust quite easy since serde is able to handle it. It also makes it easier to upgrade Nix and not have to change the bindings or C API.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno, the whole point of the C API is to provide an unambiguous and ABI stable efficient interface for accessing things. Adding JSON strings into the mix seems strange. JSON derivations are a separate thing since at some point those should stop changing...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is understandable and makes sense, though I'd like to see what others think who have also worked with the C API. Probably @roberth is good to bring in to discuss this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c api Nix as a C library with a stable interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants