Commit graph

31 commits

Author SHA1 Message Date
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
c986c09b8c feat: Store.parse_store_path()
(cherry picked from commit 6b92d4164b94d5030929dfb56577b1fd8d62e067)
2025-10-04 02:31:16 +02:00
Robert Hensing
c9d54ccbc6 feat: Store.get_storedir()
(cherry picked from commit 6f4ba636f1e563167e6456d42c9fb6f65c9ca504)
2025-10-04 02:31:16 +02:00
Robert Hensing
3d3c77eced doc: StorePath.name()
(cherry picked from commit 2f3dc27eb816634ebb8edbabd409ebc52db9a0bb)
2025-10-04 02:31:16 +02:00
Robert Hensing
ce07ed1c07 fix: Mark all StorePath pointer management as unsafe
... because it is. I had previously dismissed the comparatively
trivial unsafety of these functions, assuming the caller is
aware of the purpose of them and reasonably familiar with manual
memory management.
That would have been fine in an unsafe by default language like C++,
which Rust is not.

(cherry picked from commit b43455fdd0468f067741a79a7031ba2fa907f0eb)
2025-10-04 02:31:16 +02:00
Robert Hensing
6193575d1e fix: Require non-null pointer in StorePath
Fixes https://github.com/nixops4/nixops4/issues/65,
possible undefined behavior.

This doesn't make the code nice wrt *const/*mut distinction, but
since we're not mutating it, this should be fine.

(cherry picked from commit 75d448aad923a5f835f0562400e223df43103ea4)
2025-10-04 02:31:16 +02:00
Robert Hensing
12d3d62108 fix: Deduplicate stores to work around nix#11979
Fixes tests hanging. Before this commit:

    nix build .#packages.x86_64-linux.nixops4-eval-release

See https://github.com/NixOS/nix/issues/11979

(cherry picked from commit 03af71f92488f2ee683565318f24afd3e3c001df)
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
9213c9a5a0 feat: Make Cargo.toml source locations explicit
This allows cargo metadata to operate on it without adding the
source files to the build. (A choice which will save a few rebuilds
of the manual)

(cherry picked from commit 1779295f3e13cc15f8422d52a3753bb927ac8fa7)
2025-10-04 02:31:16 +02:00
Robert Hensing
01c9d0b2d3 feat: EvalState.weak_ref()
(cherry picked from commit d7a72c82ebfbfbb1b58fa15044b63648b2109260)
2025-10-04 02:31:16 +02:00
Robert Hensing
e0dead151e feat: Store.weak_ref()
(cherry picked from commit 2fdcc5df62a6cea790bea9b867e1b6d044d4a28f)
2025-10-04 02:31:16 +02:00
Robert Hensing
03f6c63373 feat: impl Clone for Store
(cherry picked from commit 90750c3c82ab0a5973de634661c5284c74fc89a8)
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
Philipp Zander
ec28176852 adjust all tests to nix_store_open's new signature
(cherry picked from commit da9bf071709bc9e48a0a02531e78b2a71a9b4eba)
2025-10-04 02:31:16 +02:00
Philipp Zander
de09abb084 support nix_store_open's params argument
(cherry picked from commit 3dd5137e33709559ffa152feb7ab508246adfb54)
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
4688ccbf95 refact: Make the callback convert to Result<String> immediately
This is slightly easier to use than the previous pattern that was
always followed up by the same conversions.

(cherry picked from commit 756c080730cd4fa81d4c0e3a99688cbe8debe57f)
2025-10-04 02:30:46 +02:00
Robert Hensing
9a6ef0489e doc: Clarify ownership around StorePath::new_*
(cherry picked from commit 397f00e8eefff376759f05bd0cbaecc106c681df)
2025-10-04 02:30:46 +02:00
Robert Hensing
87203ef394 feat: EvalState.realise_string
(cherry picked from commit f2b1142018fd64dd45ec97f1eccf0c48cc4a8c6d)
2025-10-04 02:30:46 +02:00
Robert Hensing
acb1274c08 refact: Add callback_get_vec_u8_data
Make it easier to correctly use the string callbacks.

(cherry picked from commit 32db5dfc020053c36b7a4776313ee72d7bc961dd)
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
Erin van der Veen
9d26e36b85 feat: update nix input to latest master
The nix c bindings have now merged into master, with some small changes since these bindings were created.
This commit updates the input, and adjusts it to the new API.

(cherry picked from commit aa02380bfcc6221615f65152de60cf4cca3bbbbe)
2025-10-04 02:30:46 +02:00
Robert Hensing
759577526d maint: Update get_uri to be callback based
(cherry picked from commit 1aaf9b4d764da5aa8c1297d87ad1002bf1d7a7ea)
2025-10-04 02:30:46 +02:00
Robert Hensing
dbab66b38d maint: Ignore get_uri_nixos_cache because of network access
(cherry picked from commit 89736dd18452d11b11e4581a549da1df956d81c6)
2025-10-04 02:30:46 +02:00
Robert Hensing
36ea74c707 dev: Use unwrap to see error message in test
(cherry picked from commit c1c86ebee4418d37053add884b9c1258b22dd7ed)
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
Robert Hensing
270ccaaa57 feat: Add create nix-store
(cherry picked from commit b9150e82be712b2cd82d689f0f26c2a133564701)
2025-09-30 18:54:46 +02:00