-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional simplified configuration syntax #144
Conversation
This looks good once we can get the checks to pass (it worked on my config just fine). I'm OK with these changes enough that I can merge this when this is fixed. Continuing the discussions on the nested groups thing, a big problem was that it paired quite badly with the new format. For example the following config: programs.plasma.configFile.somefile.group1.group2.group3.key = { value = 1; immutable = true;}; could be interpreted in two ways:
Additionally it made things more hard to debug to the point it hindered innovation in other parts of the project. This is a little different to the examples you brought up which are effectively just json and ini types (and those types support the recursive structures). There they are able to just write this to config directly without having to do much parsing (since the outputs there are json or ini). I didn't mean that the syntax itself was complicated, the syntax is probably better (I just don't think it's worth it in the grand scheme of the project). Seeing as I'm not going to be much involved in the project in the future, I'm not going to block any prs because of the maintainability argument though if there is significant disagreement here though. |
Ack, I tested with It looks like the one failing check is
I think you can resolve this unambiguously by saying "If an attrset is a valid value, treat it as a value. Otherwise, expand it into an attrset of values." So in this example, it would be treated as case 1, and if you wanted case 2, you would need to set Another rare case that I noticed is that it's technically possible for the same name to be used as both a key and a group. i.e. [group1]
group2 = first value
[group1][group2]
key = second value which wouldn't be possible with recursive definitions. IDK if that ever happens in practice.
Speaking of "hard to debug", I'm actually working on another branch where I added a bunch more tests to |
Nice, I'll check if this works (though we should probably update the other example flakes as well then). Regarding recursively nested attrs, one thing to note is that I believe I have seen groups where one may want to set keys with the name "immutable" and maybe "value" and "persistence" as well, so it could be a somewhat rare, but still valid use-case which would have two interpretations for I'm curious about the other pr which adds some tests, and if it's sent within a week or so I can probably review that and fix some additional bugs in the python script. |
WDYT about removing |
The flake.lock file isn't really the important part in the examples, I think the main reason for them being there is so that the flake check doesn't fail. I think this sounds like a good idea |
The CI now uses `--override-input` to point the `plasma-manager` input to the plasma-manager version under test.
Alright, I just pushed that change. |
Nice, this looks good now then, I'll merge once the CI completes. |
See comments on #94 for more discussion.
The recent change to add a
.value
to everyconfigFile
setting made my configuration much more verbose.This PR uses
lib.types.coercedTo
to support both old-styleas well as the new
With this change, plasma-manager is now compatible with both old and new user configurations, aside from keys in nested groups. I added test cases to the flake check to make sure that's true.
It sounds like the behavior of nested groups is more controversial, so I'll split that off into a separate PR. This PR preserves the new syntax of
apprc."foo/bar".field
for nested groups, so any existing configs with nested groups are still incompatible with HEAD.