This builds on the previous commit to make it compatible with the
currently locked build configuration.
(cherry picked from commit bd1edec2fa5251263c768c3e2b312eb4f21d2bb4)
Fixes#106
The Nix settings system uses global mutable state without internal
synchronization. When multiple threads call settings::set concurrently
(as happens in parallel test execution), this causes a segfault in the
C++ std::set implementation.
Changes:
- Add mutex to serialize access through the Rust API
- Add documentation explaining thread safety limitations
- Add Once guard in nix-flake tests to minimize concurrent access
The mutex provides protection between Rust callers, though it cannot
completely prevent C++ Nix code from modifying settings concurrently.
(cherry picked from commit 203917657b60c4e1dcbaf442bec64c37c634abc4)
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)
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)
> I couldn't figure out a way to use () for the function call, but I didn't try that hard.
I (Robert) have also given it a shot, briefly, unsuccessfully.
While I was critical of over-engineering this, it turns out that
when we start to use `mut`, a macro is much more practical, because
it doesn't create a new scope where we need a copy of a mutable
reference, which of course is not allowed.
(cherry picked from commit a2acc93d13991da4b14a99065acd589477334d07)
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)
This makes it easier to stick to a regular pattern and not forget
to check the context afterwards.
(cherry picked from commit 966ef3769a23075f5d660a48cf5a7307df925dbf)
This is slightly easier to use than the previous pattern that was
always followed up by the same conversions.
(cherry picked from commit 756c080730cd4fa81d4c0e3a99688cbe8debe57f)