-
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
nix_rs: Inherit stderr
while running nix
as a child process
#222
Conversation
stderr
while running nix
as a child process
Upon inheriting Do we need Making |
Oh no, It doesn’t: "om": {
"doc": "Configuration for `omnix` CLI.\n",
"output": {
"children": {
"ci": {
"leaf": true
},
"health": {
"leaf": true
}
}
}
}, I will have to recursively |
Upon recursively creating these children, it seems to sorta work: "om": {
"doc": "Configuration for `omnix` CLI.\n",
"output": {
"children": {
"ci": {
"children": {
"default": {
"children": {
"cli-test-dep-cache": {
"children": {
"dir": {
"leaf": true
}
}
},
"doc": {
"children": {
"dir": {
"leaf": true
}
}
},
"flakreate-registry": {
"children": {
"dir": {
"leaf": true
}
}
},
"omnix": {
"children": {
"dir": {
"leaf": true
}
}
}
}
}
}
}, But if you notice, along with “leaf” we don’t have the attribute mentioning the “value” of the leaf node, even though it is added in the schema: {
let
omSchema = {
version = 1;
doc = ''
Configuration for `omnix` CLI.
'';
inventory = output:
let
recurse = prefix: attrs: self.lib.mkChildren (builtins.mapAttrs
(attrName: attrs:
if (builtins.typeOf attrs) != "set" then
{
value = attrs;
what = "omnix config";
}
else
recurse (prefix + attrName + ".") attrs
)
attrs);
in
recurse "" output;
};
in
} |
That is an easy fix in Note to self: Mention this use case in |
voila "om": {
"doc": "Configuration for `omnix` CLI.\n",
"output": {
"children": {
"ci": {
"children": {
"default": {
"children": {
"cli-test-dep-cache": {
"children": {
"dir": {
"leaf": true,
"value": "crates/omnix-cli/tests",
"what": "omnix config"
}
}
},
"doc": {
"children": {
"dir": {
"leaf": true,
"value": "doc",
"what": "omnix config"
}
}
},
"flakreate-registry": {
"children": {
"dir": {
"leaf": true,
"value": "crates/flakreate/registry",
"what": "omnix config"
}
}
},
"omnix": {
"children": {
"dir": {
"leaf": true,
"value": ".",
"what": "omnix config"
}
}
}
}
}
}
}, |
See also #211 (omnix flake-module) We also want to support the scenario of there not being any |
Is flake-schemas really relevant here? Consider the maintenance burden we would be taking on. Keeping all 3 places -- Rust types, flake-parts module, and flake-schema -- in sync. |
#214 should solve the burden of maintaining Rust types?
Aren’t we maintaining the flake-parts module in
That would require maintaining a fork until the upstream merge happens, I can keep this up-to-date, now that I am slowly getting familiarised with the |
I did try to find different ways to not rely on the |
Feel free to explore the flake-schemas route. I'd be curious to see how it looks, in the end. Right now, I don't have a clear of idea of what is entailed.
Can't the flake-schema live in this repo itself? I thought flake-schemas are meant to be decentralized, anyway (i.e., downstream flakes can specify their own schemas). |
For Not necessarily for stuff like #216 Here's an idea: keep Rust types as canonical source of truth, and then generate the Nix expression necessary for creating flake-parts module and flake-schema from it ... in the same vein as https://hackage.haskell.org/package/purescript-bridge |
108c0de
to
8426455
Compare
This PR changes a bunch of things, to make the review simpler here are the primary changes:
|
(Had to merge from |
@srid added a couple of TODO’s to the description, feel free to add more if I missed any |
@srid do you mean to update the example itself? i.e to show something with less of “N/A” or to show the progress of “nix flake show” due to inherited stderr? |
Former. Less of N/A. |
Nevermind; I thought we are doing |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Apart from Refactoring |
We can get rid of (You can also drop by huddle to pair on it) |
resolves #209
We also use
flake-schemas
in this PR to fetch theom
config from the flake output instead of usingnix eval
(since inheritingstderr
means it's no longer captured forom
to process). An additional, unintended benefit of usingflake-schemas
is caching the output ofnix flake show
.Changes in nix CLI
shivaraj-bh/nix@1d23c1e
Demo
TODO
nix_rs
changeloghistory.md
flake-schemas
as local flake (foromSchema
) while importing majority of schemas from DetSys/flake-schemasfind_qualified_attr_in_flake_output
toFlakeOutputs
FlakeOutputs
serialization… use untagged for flatteningnix/flake-schemas/flake.nix