@@ -25,6 +25,8 @@ typedef struct Store Store;
25
25
typedef struct StorePath StorePath ;
26
26
/** @brief Nix Derivation */
27
27
typedef struct nix_derivation nix_derivation ;
28
+ /** @brief Nix Derivation Output */
29
+ typedef struct nix_derivation_output nix_derivation_noutput ;
28
30
29
31
/**
30
32
* @brief Initializes the Nix store library
@@ -245,6 +247,86 @@ void nix_derivation_free(nix_derivation * drv);
245
247
*/
246
248
nix_err nix_store_copy_closure (nix_c_context * context , Store * srcStore , Store * dstStore , StorePath * path );
247
249
250
+ /**
251
+ * @brief Returns the derivation associated with the store path
252
+ *
253
+ * @note The callback borrows the Derivation only for the duration of the call.
254
+ *
255
+ * @param[out] context Optional, stores error information
256
+ * @param[in] store The nix store
257
+ * @param[in] path The nix store path
258
+ * @param[in] callback The callback to call
259
+ * @param[in] userdata The userdata to pass to the callback
260
+ */
261
+ nix_err nix_store_drv_from_path (
262
+ nix_c_context * context ,
263
+ Store * store ,
264
+ const StorePath * path ,
265
+ void (* callback )(void * userdata , const nix_derivation * drv ),
266
+ void * userdata );
267
+
268
+ /**
269
+ * @brief Iterate through all of the outputs in a derivation
270
+ *
271
+ * @note The callback borrows the DerivationOutput only for the duration of the call.
272
+ *
273
+ * @param[out] context Optional, stores error information
274
+ * @param[in] drv The derivation
275
+ * @param[in] callback The function to call on every output
276
+ * @param[in] userdata Userdata to pass to the callback
277
+ */
278
+ nix_err nix_derivation_get_outputs (
279
+ nix_c_context * context ,
280
+ const nix_derivation * drv ,
281
+ void (* callback )(void * userdata , const char * name , const nix_derivation_output * drv_output ),
282
+ void * userdata );
283
+
284
+ /**
285
+ * @brief Iterate and get all of the derivation outputs and their store paths.
286
+ *
287
+ * @note The callback borrows the DerivationOutput and StorePath only for the duration of the call.
288
+ *
289
+ * @param[out] context Optional, stores error information
290
+ * @param[in] drv The derivation
291
+ * @param[in] store The nix store
292
+ * @param[in] callback The function to call on every output and store path
293
+ * @param[in] userdata The userdata to pass to the callback
294
+ */
295
+ nix_err nix_derivation_get_outputs_and_optpaths (
296
+ nix_c_context * context ,
297
+ const nix_derivation * drv ,
298
+ const Store * store ,
299
+ void (* callback )(
300
+ void * userdata , const char * name , const nix_derivation_output * drv_output , const StorePath * path ),
301
+ void * userdata );
302
+
303
+ /**
304
+ * @brief Gets the structured attrs of derivation as a JSON string
305
+ *
306
+ * @param[out] context Optional, stores error information
307
+ * @param[in] drv The derivation
308
+ * @param[in] callback Called with the JSON string
309
+ * @param[in] user_data Arbitrary data passed to the callback
310
+ */
311
+ nix_err nix_derivation_get_structured_attrs (
312
+ nix_c_context * context , const nix_derivation * drv , nix_get_string_callback callback , void * userdata );
313
+
314
+ /**
315
+ * @brief Copy of a 'nix_derivation_output'
316
+ *
317
+ * @param[in] o the derivation output to copy
318
+ * @return a new 'nix_derivation_output'
319
+ */
320
+ nix_derivation_output * nix_derivation_output_clone (const nix_derivation_output * o );
321
+
322
+ /**
323
+ * @brief Deallocate a 'nix_derivation_output'
324
+ *
325
+ * Does not fail.
326
+ * @param[in] o the derivation output to free
327
+ */
328
+ void nix_derivation_output_free (nix_derivation_output * o );
329
+
248
330
// cffi end
249
331
#ifdef __cplusplus
250
332
}
0 commit comments