-
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
Use YAML for config #352
base: main
Are you sure you want to change the base?
Use YAML for config #352
Conversation
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 looks good so far. Can we improve the OmConfig::get
interface so as to resolve and avoid unnecessary nix
command runs? See #339 (comment)
/// Fetch the `om` configuration from `om.yaml` if present, falling back to `om` config in flake output | ||
pub async fn get(cmd: &NixCmd, flake_url: &FlakeUrl) -> Result<Self, OmConfigError> { | ||
match Self::from_yaml(cmd, flake_url).await { | ||
Err(OmConfigError::YamlNotFound(_)) => Self::from_flake(cmd, flake_url).await, |
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 just realized I got confused (see "catchall" comment here) by YamlNotFound
. Because it a value of OmConfigError, I somehow confused it to refer to yaml errors.
Just get rid of YamlNotFound
and have from_yaml
return Option<Self>
instead, so the caller can do fallback on None
.
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.
If from_yaml
returns Option<Self>
will we not be silently skipping over errors while parsing the YAML?
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.
No, I meant:
async fn from_yaml(cmd: &NixCmd, flake_url: &FlakeUrl) -> Result<Option<Self>, OmConfigError> {
Aren’t those omnix/crates/omnix-develop/src/core.rs Lines 45 to 57 in af87950
|
resolves #343
If the flake url is a local path and
om.yaml
exists in the project root,omnix
will not invokenix eval .#om
.