-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
libstore-c: add more derivation functions #14031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
libstore-c: add more derivation functions #14031
Conversation
src/libstore-c/nix_api_store.h
Outdated
/** @brief Nix Derivation */ | ||
typedef struct nix_derivation nix_derivation; | ||
/** @brief Nix Derivation Output */ | ||
typedef struct nix_derivation_output nix_derivatio_noutput; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typedef struct nix_derivation_output nix_derivatio_noutput; | |
typedef struct nix_derivation_output nix_derivation_output; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one and associated functions is not needed if the consumer uses the JSON
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
I have a preference that consumers should achieve these goals by deserializing the JSON themselves. Then we can make do with a smaller interface which will be easier to maintain and more stable. |
NIXC_CATCH_ERRS | ||
} | ||
|
||
nix_err nix_derivation_get_outputs_and_optpaths( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just be the opt paths, which is useful for the FOD case. The outputs themselves can be gotten from the JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is me elaborating what I wrote in #14031 (comment)
521f2c9
to
cd12d13
Compare
How do I get the JSON myself? All I have is a store path. |
|
Isn't there increased overhead if everything is being accessed through JSON? Wouldn't some operations make sense to do without deserializing? |
I would say optimization should come later. Let's see evidence of there being a bottleneck in practice before we make the interface bigger. |
df99081
to
d0c6698
Compare
d0c6698
to
4ffac98
Compare
|
c1e3593
to
bdf7104
Compare
Ah does anything use the |
I'm looking at our usage and it looks like there's not much usage of it. |
517c686
to
bec7506
Compare
bec7506
to
96b3f09
Compare
nix_err nix_derivation_make_outputs( | ||
nix_c_context * context, | ||
Store * store, | ||
const char * json, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should take a nix_derivation
, not parse the JSON itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we'll have to remove the verify function to even be able to get a nix_derivation
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm? I am not sure what you mean. You mean to make an input-addressed derivation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd have to remove this:
nix/src/libstore-c/nix_api_store.cc
Line 190 in 772a380
drv.checkInvariants(*store->ptr, drvPath); |
The checkInvariants
function failing with a mismatch outpath hash error can prevent a nix_derivation
from returning. If nix_derivation_make_outputs
needs a nix_derivation
and you can't get one without getting the right outpath hashes, now we have a catch-22 and it'll be impossible to add derivations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to bed, but we can look into this soon, I think we should be able to untangle it perhaps simpler than you think
Motivation
Upstreaming more C API exposure, specifically more derivation related things.
Context
Comes from DeterminateSystems#210
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.