Nix 2.29.0
Nix, the purely functional package manager: C API (experimental)
Loading...
Searching...
No Matches
libflake

Bindings to the Nix Flakes library. More...

Files

file  nix_api_flake.h
 Main entry for the libflake C bindings.

Typedefs

typedef struct nix_flake_settings nix_flake_settings
 A settings object for configuring the behavior of the nix-flake-c library.
typedef struct nix_flake_reference_parse_flags nix_flake_reference_parse_flags
 Context and paramaters for parsing a flake reference.
typedef struct nix_flake_reference nix_flake_reference
 A reference to a flake.
typedef struct nix_flake_lock_flags nix_flake_lock_flags
 Parameters for locking a flake.
typedef struct nix_locked_flake nix_locked_flake
 A flake with a suitable lock (file or otherwise)

Functions

nix_flake_settingsnix_flake_settings_new (nix_c_context *context)
void nix_flake_settings_free (nix_flake_settings *settings)
 Release the resources associated with a nix_flake_settings.
nix_err nix_flake_settings_add_to_eval_state_builder (nix_c_context *context, nix_flake_settings *settings, nix_eval_state_builder *builder)
 Initialize a nix_flake_settings to contain builtins.getFlake and potentially more.
nix_flake_reference_parse_flagsnix_flake_reference_parse_flags_new (nix_c_context *context, nix_flake_settings *settings)
 A new nix_flake_reference_parse_flags with defaults.
void nix_flake_reference_parse_flags_free (nix_flake_reference_parse_flags *flags)
 Deallocate and release the resources associated with a nix_flake_reference_parse_flags. Does not fail.
nix_err nix_flake_reference_parse_flags_set_base_directory (nix_c_context *context, nix_flake_reference_parse_flags *flags, const char *baseDirectory, size_t baseDirectoryLen)
 Provide a base directory for parsing relative flake references.
nix_flake_lock_flagsnix_flake_lock_flags_new (nix_c_context *context, nix_flake_settings *settings)
 A new nix_flake_lock_flags with defaults.
void nix_flake_lock_flags_free (nix_flake_lock_flags *settings)
 Deallocate and release the resources associated with a nix_flake_lock_flags. Does not fail.
nix_err nix_flake_lock_flags_set_mode_check (nix_c_context *context, nix_flake_lock_flags *flags)
 Put the lock flags in a mode that checks whether the lock is up to date.
nix_err nix_flake_lock_flags_set_mode_virtual (nix_c_context *context, nix_flake_lock_flags *flags)
 Put the lock flags in a mode that updates the lock file in memory, if needed.
nix_err nix_flake_lock_flags_set_mode_write_as_needed (nix_c_context *context, nix_flake_lock_flags *flags)
 Put the lock flags in a mode that updates the lock file on disk, if needed.
nix_err nix_flake_lock_flags_add_input_override (nix_c_context *context, nix_flake_lock_flags *flags, const char *inputPath, nix_flake_reference *flakeRef)
 Add input overrides to the lock flags.
nix_locked_flakenix_flake_lock (nix_c_context *context, nix_fetchers_settings *fetchSettings, nix_flake_settings *settings, EvalState *eval_state, nix_flake_lock_flags *flags, nix_flake_reference *flake)
 Lock a flake, if not already locked.
void nix_locked_flake_free (nix_locked_flake *locked_flake)
 Deallocate and release the resources associated with a nix_locked_flake. Does not fail.
nix_err nix_flake_reference_and_fragment_from_string (nix_c_context *context, nix_fetchers_settings *fetchSettings, nix_flake_settings *flakeSettings, nix_flake_reference_parse_flags *parseFlags, const char *str, size_t strLen, nix_flake_reference **flakeReferenceOut, nix_get_string_callback fragmentCallback, void *fragmentCallbackUserData)
 Parse a URL-like string into a nix_flake_reference.
void nix_flake_reference_free (nix_flake_reference *store)
 Deallocate and release the resources associated with a nix_flake_reference.
nix_valuenix_locked_flake_get_output_attrs (nix_c_context *context, nix_flake_settings *settings, EvalState *evalState, nix_locked_flake *lockedFlake)
 Get the output attributes of a flake.

Detailed Description

Bindings to the Nix Flakes library.

Typedef Documentation

◆ nix_flake_lock_flags

◆ nix_flake_reference

A reference to a flake.

A flake reference specifies how to fetch a flake.

See also
nix_flake_reference_from_string
nix_flake_reference_free

◆ nix_flake_reference_parse_flags

Context and paramaters for parsing a flake reference.

See also
nix_flake_reference_parse_flags_free
nix_flake_reference_parse_string

◆ nix_flake_settings

A settings object for configuring the behavior of the nix-flake-c library.

See also
nix_flake_settings_new
nix_flake_settings_free

◆ nix_locked_flake

A flake with a suitable lock (file or otherwise)

See also
nix_flake_lock
nix_locked_flake_free
nix_locked_flake_get_output_attrs

Function Documentation

◆ nix_flake_lock()

nix_locked_flake * nix_flake_lock ( nix_c_context * context,
nix_fetchers_settings * fetchSettings,
nix_flake_settings * settings,
EvalState * eval_state,
nix_flake_lock_flags * flags,
nix_flake_reference * flake )

Lock a flake, if not already locked.

Parameters
[out]contextOptional, stores error information
[in]settingsThe flake (and fetch) settings to use
[in]flagsThe locking flags to use
[in]flakeThe flake to lock

◆ nix_flake_lock_flags_add_input_override()

nix_err nix_flake_lock_flags_add_input_override ( nix_c_context * context,
nix_flake_lock_flags * flags,
const char * inputPath,
nix_flake_reference * flakeRef )

Add input overrides to the lock flags.

Parameters
[out]contextOptional, stores error information
[in]flagsThe flags to modify
[in]inputPathThe input path to override
[in]flakeRefThe flake reference to use as the override

This switches the flags to nix_flake_lock_flags_set_mode_virtual if not in mode nix_flake_lock_flags_set_mode_check.

◆ nix_flake_lock_flags_free()

void nix_flake_lock_flags_free ( nix_flake_lock_flags * settings)

Deallocate and release the resources associated with a nix_flake_lock_flags. Does not fail.

Parameters
[in]settingsthe nix_flake_lock_flags * to free

◆ nix_flake_lock_flags_new()

nix_flake_lock_flags * nix_flake_lock_flags_new ( nix_c_context * context,
nix_flake_settings * settings )

A new nix_flake_lock_flags with defaults.

Parameters
[in]settingsFlake settings that may affect the defaults

◆ nix_flake_lock_flags_set_mode_check()

nix_err nix_flake_lock_flags_set_mode_check ( nix_c_context * context,
nix_flake_lock_flags * flags )

Put the lock flags in a mode that checks whether the lock is up to date.

Parameters
[out]contextOptional, stores error information
[in]flagsThe flags to modify
Returns
NIX_OK on success, NIX_ERR on failure

This causes nix_flake_lock to fail if the lock needs to be updated.

◆ nix_flake_lock_flags_set_mode_virtual()

nix_err nix_flake_lock_flags_set_mode_virtual ( nix_c_context * context,
nix_flake_lock_flags * flags )

Put the lock flags in a mode that updates the lock file in memory, if needed.

Parameters
[out]contextOptional, stores error information
[in]flagsThe flags to modify
[in]updateWhether to allow updates

This will cause nix_flake_lock to update the lock file in memory, if needed.

◆ nix_flake_lock_flags_set_mode_write_as_needed()

nix_err nix_flake_lock_flags_set_mode_write_as_needed ( nix_c_context * context,
nix_flake_lock_flags * flags )

Put the lock flags in a mode that updates the lock file on disk, if needed.

Parameters
[out]contextOptional, stores error information
[in]flagsThe flags to modify
[in]updateWhether to allow updates

This will cause nix_flake_lock to update the lock file on disk, if needed.

◆ nix_flake_reference_and_fragment_from_string()

nix_err nix_flake_reference_and_fragment_from_string ( nix_c_context * context,
nix_fetchers_settings * fetchSettings,
nix_flake_settings * flakeSettings,
nix_flake_reference_parse_flags * parseFlags,
const char * str,
size_t strLen,
nix_flake_reference ** flakeReferenceOut,
nix_get_string_callback fragmentCallback,
void * fragmentCallbackUserData )

Parse a URL-like string into a nix_flake_reference.

Parameters
[out]contextcontext – Optional, stores error information
[in]fetchSettingscontext – The fetch settings to use
[in]flakeSettingscontext – The flake settings to use
[in]parseFlagscontext – Specific context and parameters such as base directory
[in]strinput – The URI-like string to parse
[in]strLeninput – The length of str
[out]flakeReferenceOutresult – The resulting flake reference
[in]fragmentCallbackresult – A callback to call with the fragment part of the URL
[in]fragmentCallbackUserDataresult – User data to pass to the fragment callback
Returns
NIX_OK on success, NIX_ERR on failure

◆ nix_flake_reference_free()

void nix_flake_reference_free ( nix_flake_reference * store)

Deallocate and release the resources associated with a nix_flake_reference.

Does not fail.

Parameters
[in]storethe nix_flake_reference * to free

◆ nix_flake_reference_parse_flags_free()

void nix_flake_reference_parse_flags_free ( nix_flake_reference_parse_flags * flags)

Deallocate and release the resources associated with a nix_flake_reference_parse_flags. Does not fail.

Parameters
[in]flagsthe nix_flake_reference_parse_flags * to free

◆ nix_flake_reference_parse_flags_set_base_directory()

nix_err nix_flake_reference_parse_flags_set_base_directory ( nix_c_context * context,
nix_flake_reference_parse_flags * flags,
const char * baseDirectory,
size_t baseDirectoryLen )

Provide a base directory for parsing relative flake references.

Parameters
[out]contextOptional, stores error information
[in]flagsThe flags to modify
[in]baseDirectoryThe base directory to add
[in]baseDirectoryLenThe length of baseDirectory
Returns
NIX_OK on success, NIX_ERR on failure

◆ nix_flake_settings_add_to_eval_state_builder()

nix_err nix_flake_settings_add_to_eval_state_builder ( nix_c_context * context,
nix_flake_settings * settings,
nix_eval_state_builder * builder )

Initialize a nix_flake_settings to contain builtins.getFlake and potentially more.

Warning
This does not put the eval state in pure mode!
Parameters
[out]contextOptional, stores error information
[in]settingsThe settings to use for e.g. builtins.getFlake
[in]builderThe builder to modify

◆ nix_flake_settings_new()

nix_flake_settings * nix_flake_settings_new ( nix_c_context * context)

Create a nix_flake_settings initialized with default values.

Parameters
[out]contextOptional, stores error information
Returns
A new nix_flake_settings or NULL on failure.
See also
nix_flake_settings_free

◆ nix_locked_flake_free()

void nix_locked_flake_free ( nix_locked_flake * locked_flake)

Deallocate and release the resources associated with a nix_locked_flake. Does not fail.

Parameters
[in]locked_flakethe nix_locked_flake * to free

◆ nix_locked_flake_get_output_attrs()

nix_value * nix_locked_flake_get_output_attrs ( nix_c_context * context,
nix_flake_settings * settings,
EvalState * evalState,
nix_locked_flake * lockedFlake )

Get the output attributes of a flake.

Parameters
[out]contextOptional, stores error information
[in]settingsThe settings to use
[in]locked_flakethe flake to get the output attributes from
Returns
A new nix_value or NULL on failure. Release the nix_value with nix_value_decref.