@@ -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_output ;
28
30
29
31
/**
30
32
* @brief Initializes the Nix store library
@@ -235,6 +237,14 @@ StorePath * nix_add_derivation(nix_c_context * context, Store * store, nix_deriv
235
237
*/
236
238
void nix_derivation_free (nix_derivation * drv );
237
239
240
+ /**
241
+ * @brief Copy a `nix_derivation`
242
+ *
243
+ * @param[in] d the derivation to copy
244
+ * @return a new `nix_derivation`
245
+ */
246
+ nix_derivation * nix_derivation_clone (const nix_derivation * d );
247
+
238
248
/**
239
249
* @brief Copy the closure of `path` from `srcStore` to `dstStore`.
240
250
*
@@ -245,6 +255,86 @@ void nix_derivation_free(nix_derivation * drv);
245
255
*/
246
256
nix_err nix_store_copy_closure (nix_c_context * context , Store * srcStore , Store * dstStore , StorePath * path );
247
257
258
+ /**
259
+ * @brief Returns the derivation associated with the store path
260
+ *
261
+ * @note The callback borrows the Derivation only for the duration of the call.
262
+ *
263
+ * @param[out] context Optional, stores error information
264
+ * @param[in] store The nix store
265
+ * @param[in] path The nix store path
266
+ * @param[in] callback The callback to call
267
+ * @param[in] userdata The userdata to pass to the callback
268
+ */
269
+ nix_err nix_store_drv_from_path (
270
+ nix_c_context * context ,
271
+ Store * store ,
272
+ const StorePath * path ,
273
+ void (* callback )(void * userdata , const nix_derivation * drv ),
274
+ void * userdata );
275
+
276
+ /**
277
+ * @brief Queries for the nix store path info.
278
+ *
279
+ * @param[out] context Optional, stores error information
280
+ * @param[in] store nix store reference
281
+ * @param[in] path A store path
282
+ * @param[in] userdata The data to pass to the callback
283
+ * @param[in] callback Called for when the path info is resolved
284
+ */
285
+ nix_err nix_store_query_path_info (
286
+ nix_c_context * context ,
287
+ Store * store ,
288
+ const StorePath * store_path ,
289
+ void * userdata ,
290
+ void (* callback )(void * userdata , const StorePath * derived_path ));
291
+
292
+ /**
293
+ * @brief Iterate and get all of the derivation outputs and their store paths.
294
+ *
295
+ * @note The callback borrows the DerivationOutput and StorePath only for the duration of the call.
296
+ *
297
+ * @param[out] context Optional, stores error information
298
+ * @param[in] drv The derivation
299
+ * @param[in] store The nix store
300
+ * @param[in] callback The function to call on every output and store path
301
+ * @param[in] userdata The userdata to pass to the callback
302
+ */
303
+ nix_err nix_derivation_get_outputs_and_optpaths (
304
+ nix_c_context * context ,
305
+ const nix_derivation * drv ,
306
+ const Store * store ,
307
+ void (* callback )(
308
+ void * userdata , const char * name , const nix_derivation_output * drv_output , const StorePath * path ),
309
+ void * userdata );
310
+
311
+ /**
312
+ * @brief Gets the derivation as a JSON string
313
+ *
314
+ * @param[out] context Optional, stores error information
315
+ * @param[in] drv The derivation
316
+ * @param[in] callback Called with the JSON string
317
+ * @param[in] user_data Arbitrary data passed to the callback
318
+ */
319
+ nix_err nix_derivation_to_json (
320
+ nix_c_context * context , const nix_derivation * drv , nix_get_string_callback callback , void * userdata );
321
+
322
+ /**
323
+ * @brief Copy of a 'nix_derivation_output'
324
+ *
325
+ * @param[in] o the derivation output to copy
326
+ * @return a new 'nix_derivation_output'
327
+ */
328
+ nix_derivation_output * nix_derivation_output_clone (const nix_derivation_output * o );
329
+
330
+ /**
331
+ * @brief Deallocate a 'nix_derivation_output'
332
+ *
333
+ * Does not fail.
334
+ * @param[in] o the derivation output to free
335
+ */
336
+ void nix_derivation_output_free (nix_derivation_output * o );
337
+
248
338
// cffi end
249
339
#ifdef __cplusplus
250
340
}
0 commit comments