Skip to content

Conversation

@numinit
Copy link

@numinit numinit commented Jan 5, 2026

Motivation

Using the Rust bindings (which call into the C bindings) to set eval-related settings was not working.

Since EvalSettings were defined in libcmd, we need to move them to libexpr if libexpr-c wants to use them. Since libcmd enforces a dependency on libflake, we also need to modify config-global to absorb duplicate registrations and support callbacks for customizing behavior that we only need in libcmd.

Note that we add back some of the global setting variables with this, but this does fix the C API.

Context

Implementation strategy, since this was slightly nontrivial:

  • Move registration for eval (and fetcher settings, which had the same issue but was easier to solve) to libexpr and libfetchers.
  • Absorb duplicate config registrations in config-global.cc.
  • Add a new GlobalConfig registration constructor allowing the caller to pass a callback; use this to break the hard libflake dependency.
  • Use pointers to the global eval and fetcher config in libexpr-c instead of creating new instances that are not bound to Nix's settings.

Add 👍 to pull requests you find important.

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

@numinit numinit requested a review from edolstra as a code owner January 5, 2026 07:30
@github-actions github-actions bot added fetching Networking with the outside (non-Nix) world, input locking c api Nix as a C library with a stable interface labels Jan 5, 2026
Using the Rust bindings (which call into the C bindings) to set
eval-related settings was not working.

Since EvalSettings were defined in libcmd, we need to move them to
libexpr if libexpr-c wants to use them. Since libcmd enforces a
dependency on libflake, we also need to modify config-global to absorb
duplicate registrations and support callbacks for customizing behavior
that we only need in libcmd.

Note that we add back some of the global setting variables with this,
but this does fix the C API.
@numinit numinit force-pushed the upstream-fix-c-api-eval-settings branch from debdf81 to 734c9e7 Compare January 5, 2026 07:36
@numinit
Copy link
Author

numinit commented Jan 5, 2026

CC @RossComputerGuy (who I bugged about this issue while tracking it down).

@roberth
Copy link
Member

roberth commented Jan 8, 2026

@Ericson2314 as Chief of Settings Cleanup, wdyt?
If I'm not mistaken, this PR pursues the same problem as

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 fetching Networking with the outside (non-Nix) world, input locking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants