-
Notifications
You must be signed in to change notification settings - Fork 10
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
Read configuration once only #341
Conversation
om develop
OmConfig
OmConfig
OmConfig
; OmConfig
represents whole om
flake output
get_sub_configs is for cases like om.templates. It is also used in om.develop, but I guess we could use get_referenced_for there. And get_referenced_for is when it makes sense for user to pick one amongst many possible sub-configs. |
Do I understand correctly that one is same as other, except for returning multiple (instead of one) keys? In that case, shouldn't |
Yes, but there is also that get_referenced_for requires the type T, that it is converting to, have a Default defined, but that is not the case in get_sub_config. |
I mean, why can't |
Ah, the confusion is to do with |
Basically, I think Decoupled from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this locally and it works. And I'm glad that this simplifies the code by consolidating config in one place, and getting rid of qualified_attr.rs (it really was complicated solution to begin with!).
Could you do the decoupling mentioned in comments? Then it can be merged.
I did the decoupling, although not super happy with the name |
crates/omnix-common/src/config.rs
Outdated
flake_url: url.without_attr(), | ||
reference, | ||
config, | ||
flake_url: flake_url.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changed the semantics. flake_url
should be without attr.
I'll try to fix this, but I do find get_sub_config_under
to be rather hard to understand (hence less confident of making these changes). I guess the low-levelness of Rust is to blame in large part, forcing us to spend extra effort trying to keep things simple.
also remove the 2nd Default fallback, which is actually wrong. if the 'ci' config exists, but 'default' is missing, that is considered error.
OmConfig
; OmConfig
represents whole om
flake outputAs was the case before #341
`om develop`: Use `FlakeUrl` without attrs for fetching `OmConfig` As was the case before #341
Before
After
Notice that we only evaluate the
om
config once in:nix eval '.#om' --json️