Commit graph

18 commits

Author SHA1 Message Date
Robert Hensing
e6b993a42b feat: nix_expr::value::__private
Exposes the Value constructors, for use by other bindings like
nix-flake, which needs to construct e.g. a flake outputs Value.

See https://github.com/nixops4/nixops4/issues/25

> We have two related issues:

> A bunch of implementation details cannot be made private, since they must be used from one of the other crates (e.g. Values are defined in the value module but used from eval_state
> While we don't want users to need to use these features, it may be good to provide escape hatches so they can interface with the raw API if they need more control.
> Problem (1) has been solved in other crates with a __private module with #[doc(hidden)] set. See for instance:

I'm leaving docs turned on for (2). The issue has more thoughts about
alternatives.

(cherry picked from commit eb6744d1519febe5b6aa6233eb3f3e8a049f12d4)
2025-10-04 02:31:16 +02:00
Robert Hensing
d19dd45bbf fix: Mark all pointer manipulation as unsafe
See b43455fdd0468f067741a79a7031ba2fa907f0eb for rationale

(cherry picked from commit b9996c6ddd3973cd419930210bf11a4d1bc6350b)
2025-10-04 02:31:16 +02:00
Robert Hensing
ad0f5d0240 fix: Remove impl Send for Value for now
They're somewhat safe to use on a different thread, but we don't need
to for now. By removing this, we'll be made aware as needed.

(cherry picked from commit 2e953d0a1268e2f19671fdbc9e721fc630ac346b)
2025-10-04 02:31:16 +02:00
Robert Hensing
b714f46e07 feat: Make nixops4-eval async
A step toward handling the arrival of new data (stdin) with priority
over commands, avoiding roundtrips and re-evaluations.

(cherry picked from commit 8a2a5197886025caf35653001f76a4b209d8c9e4)
2025-10-04 02:31:16 +02:00
Robert Hensing
9cebf1d131 feat: Value::new_borrowed
(cherry picked from commit 86e3828250d4de15f9cf49d19222eb382c77f7e2)
2025-10-04 02:31:16 +02:00
Robert Hensing
ee1d591e1a fix: Update for more recent Nix API
(cherry picked from commit 55355f03ab86dfa15972681d9a51d333739f6d10)
2025-10-04 02:31:16 +02:00
Taeer Bar-Yam
cc2e640e7f check_call!() macro to use () not []
(cherry picked from commit 66d255af0a5d331782dc24c89bb45d3434f3c109)
2025-10-04 02:31:16 +02:00
Robert Hensing
35803f4a30 refactor: Remove check_one_call
(cherry picked from commit 065f880e52c6d6cb44e4b857272176ebe2464eea)
2025-10-04 02:31:16 +02:00
Robert Hensing
a6dbf17778 fix: Require mutable Context, as it should be
This spreads out transitively to many places and requires that
we use `check_call!` instead of `check_one_call` in a number of
places.

(cherry picked from commit 6bc31dcf206518a7be7f0ac6e773d5dfe25531ea)
2025-10-04 02:31:16 +02:00
Robert Hensing
2f3a5fb039 refact: Clean up Context interface to be safer
The mutation-based methods had some pitfalls, and we don't really
need them.

We could re-add them if we need to.

(cherry picked from commit ca92b8491d87cebf54dd2468599168fc7a16c07f)
2025-10-04 02:31:16 +02:00
Robert Hensing
22ffd20c53 refact: Use Option instead of custom ValueTypeOrThunk
This loses the custom name for "thunk", but checking thunkness is
a niche use case that I don't think we should spend much code on.

(cherry picked from commit 7bdff525c13234ce6a32ea9346292d948b0840c1)
2025-10-04 02:31:16 +02:00
Philipp Zander
673f80e243 refact: remove Thunk from ValueType and introduce ValueTypeOrThunk to address #30
(cherry picked from commit 97c05175b633b364686790549b11e43cfb2f1d2c)
2025-10-04 02:31:16 +02:00
Robert Hensing
37da6411d0 maint: Use /// for doc comments
(cherry picked from commit 4a390197f71653dda99696ed5c9cbca8c6a95a4b)
2025-10-04 02:31:16 +02:00
Robert Hensing
fbbc7cb490 feat: EvalState.require_int
(cherry picked from commit 890441adf963f1a33ba75889cc9735deeefbf51c)
2025-10-04 02:30:46 +02:00
Taeer Bar-Yam
48af0f9e41 error checking tweaks
(cherry picked from commit 6ac38519b710e69a0c30eb0fe8fc5fa712168cb8)
2025-10-04 02:30:46 +02:00
Taeer Bar-Yam
c2159c8834 bindgen strip nix_ prefix
(cherry picked from commit d07ec1990015f5d12b39da40ad0cb1ef0e798642)
2025-10-04 02:30:46 +02:00
Robert Hensing
af86728386 feat: EvalState.require_string
(cherry picked from commit ac29248e10d6e2364138d11196151a9f445b379d)
2025-10-04 02:30:46 +02:00
Robert Hensing
6978e91fa9 feat: Add nix-expr library, update nix
(cherry picked from commit bf1ddd1c9137578b86895577d5b80e0c5771b605)
2025-09-30 19:06:17 +02:00