Conversation
|
@L-as I think I need to UBSAN, because the store unit tests are failing for what looks like a random variable corruption. |
|
We should just enable it by default, but it causes some weird test failures. |
|
I don't really get the motivation for this change (another massive refactoring PR, which I assume will be followed by an even bigger change when this gets applied to the main settings). #10766 doesn't really give a motivation other than "we always go directly from a StoreReference to the Store data type directly" which is apparently a bad thing. #11106 mentions support for structured settings, but I don't see why that requires completely replacing the current This PR scatters the settings mechanism for a class like I don't really like types like: We should really keep the template metaprogramming to a minimum! Again for readability, this is not great since looking at this code, the reader has no idea what |
I believe it's quite valuable in this situation, and not all that confusing when documented properly. For this we can make use of the language server. (not using one is cruel anyway) Example: diff --git a/src/libstore/binary-cache-store.hh b/src/libstore/binary-cache-store.hh
index af649aaab..a638248c5 100644
--- a/src/libstore/binary-cache-store.hh
+++ b/src/libstore/binary-cache-store.hh
@@ -13,6 +13,7 @@ namespace nix {
struct NarInfo;
+/** @param T Either 'nix::config::JustValue' or `nix::config::SettingInfo` */
template<template<typename> class F>
struct BinaryCacheStoreConfigT
{
diff --git a/src/libutil/config-abstract.hh b/src/libutil/config-abstract.hh
index 2c34ff50b..e7f71e700 100644
--- a/src/libutil/config-abstract.hh
+++ b/src/libutil/config-abstract.hh
@@ -5,6 +5,9 @@
namespace nix::config {
+/**
+ * Just a value, no metadata. explain explain
+ */
template<typename T>
struct JustValue
{With docs in these positions, readers can easily navigate to the explanations in the two relevant types that instantiate the fields. Note also that when hovering over a |
ede1c2b to
6ba8c57
Compare
382f994 to
38b376c
Compare
|
If the Linux tests fail again, I think it might something to do with UBSan? I'll need to figure out how to run that locally. |
9511fe1 to
668c465
Compare
|
Yay, fixed the UBSAN issues! |
| static const std::string name() { return "Local Daemon Store"; } | ||
|
|
||
| std::string doc() override; | ||
| static std::string doc(); |
There was a problem hiding this comment.
We I think we could, but I am tempted to do in a separate commit since this one is already so big. How does that sound?
| } catch (nlohmann::json::exception &) { | ||
| // if its not valid JSON... | ||
| if (k == "remote-program" || k == "system-features") { | ||
| // Back compat hack! Split and take that array |
There was a problem hiding this comment.
Can we not do hacks? Presumably this needs to be part of the non-JSON parsing logic only.
There was a problem hiding this comment.
I am trying to allow query parameters to also be JSON, however. For example, I made it so ssh://localhost?remote-program=["nix","store","--serve"] works (provided one does enough HTML % escaping).
|
|
||
| void adl_serializer<ref<const StoreConfig>>::to_json(json & obj, ref<const StoreConfig> s) | ||
| { | ||
| // TODO, for tests maybe |
| #include <optional> | ||
|
|
||
| namespace nix::config { | ||
|
|
There was a problem hiding this comment.
Needs documentation. I believe this was part of an earlier review.
d146a6e to
c7a1caa
Compare
e302ab6 to
2daf1ee
Compare
9b5b2b9 to
2ea9f59
Compare
c7f126b to
fe8b42d
Compare
fe8b42d to
62690d4
Compare
c2610cc to
942bb19
Compare
a51537f to
6f7ab17
Compare
This is good for e.g. `std::string_view` and `StringMap`. Needed by NixOS#11139 Co-authored-by: Sergei Zimmerman <[email protected]>
This is good for e.g. `std::string_view` and `StringMap`. Needed by NixOS#11139 Co-authored-by: Sergei Zimmerman <[email protected]>
0a75222 to
736af35
Compare
736af35 to
782b014
Compare
f4ae2c4 to
bb7b84b
Compare
Motivation: See the linked issues for details. The most notable user-relevant bits are: - This cleans up the `MountedSSHStore`: decomposed into its orthogonal parts - This brings us pretty close to being able to then implement a JSON-based config. - Store query parameters can be JSON - Stores can entirely be specified via JSON objects, but this is not yet hooked up to anything. Also behind the scenes have these benefits: 1. The docs are moved out of the headers, good for less rebuilding when they changes 2. Stores are always constructed from store configs 3. Use JSON, avoid custom serializers Allow putting description and default together, which works in most, but not all, cases. Context: Part of NixOS#11106 Co-Authored-By: Robert Hensing <[email protected]> Co-authored-by: Sergei Zimmerman <[email protected]>
bb7b84b to
1b3c411
Compare
Motivation
See the linked issues for details.
The most notable user-relevant bits are:
This cleans up the
MountedSSHStore: decomposed into its orthogonal partsThis brings us pretty close to being able to then implement a JSON-based config.
Also behind the scenes have these benefits:
Requirements
General requirements for settings:
Other requirements:
nix.confcan be in JSON, not a custom line oriented formatconfiguration.hh, there is a huge amount of inheritance. This new system avoids that entirely. Parsing is just a function.StoreReference) into doing actions to open aStorein one step.libstore/libexprin the library use-case.Context
Do not review by commits
Part of #11106
Depends on #13154
Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.