-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
PR to support modular interface? #22
Comments
In general, great idea! I already use the NixOS module system for networking configuration. However, this piece of code already has a few ways of calling it. I prefer the managability and flexibility of putting To me it starts to make sense if we start defining all the OpenWRT options as sensible NixOS module options. @ehmry launched a fork into this direction starting in #9. Although it would be nice to have, I am not sure I am ready to maintain and update such a bulk of declarations. Can it be automated just like I've done with the download hashes? |
I'm not working with OpenWRT anymore so I'm not maintain my module fork. As I recall @Mic92 has similar configuration work that is relevant. |
There is also https://git.eno.space/dewclaw.git/tree/ now. |
Hey, @tomeon! I noticed that your sourcehut repository is active and that you have implemented a very comprehensive module system, including the flake-parts module ❤️. Are you still interested in creating a PR to port it to this repository? 👀 I believe everyone would benefit from a more modular system that allows for atomic changes, better type-safety, and auto-generated documentation similar to NixOS modules. Regarding @astro's comment:
I think @tomeon's approach to modules is simpler and easier to maintain than what was proposed in #9. While it would be great to have many individual services wrapped into Nix expressions like NixOS service modules, I agree that it would be hard to maintain. In my opinion, wrapping UCI expressions into NIX and exposing |
@astro -- apologies for taking so long to reply here. Maybe it is superfluous now that #48 appears to have traction, but I'd like to put my thoughts down anyway. I agree with @pedorich-n's remark that
However, since it's likely everyone here is already convinced of the benefits of modular systems in general and the NixOS module system in particular, let's talk about the benefits specific to my implementation of a modular interface to this project.
It's not inconvenient for me personally, or (as far as I can guess) for any single person. However, there is the potential for the collective inconvenience of repeated wheel-reinvention. One of my goals in implementing a modular interface is to expose interfaces at various levels of abstraction, reducing the likelihood of needing to re-implement low-level plumbing while still making it possible to futz with the plumbing when necessary. A case in point here is the layering of options that eventually get composed into the derivation that's passed as the
At each of these levels, barring the lowest,1 it is possible to take the reins directly:
I believe this represents a reasonably thorough hierarchy that balances power and convenience. Regarding
I again concur with @pedorich-n's remarks. I do not think that it would be straightforward or even possible to implement a comprehensive modeling of "all the OpenWRT options". For one, I don't think there is any canonical representation of all available options, other than their implementation in the OpenWRT codebase. I certainly have not found any API that can be queried to get all of these options and their default values for a given OpenWRT-supported device. Instead, I've focused on building a more-or-less comprehensive interface to the UCI defaults system.2 This way, consumers of the modular interface can declare and define just the settings that they need for the target device. It might not be as polished an experience as working with NixOS itself -- however, if the modeling of the UCI defaults system is reasonably comprehensive, then it could be used as the basis for implementing even-higher-level interfaces if and when it looks like it would be useful to do so. Footnotes
|
I like the module system, and there seem to be even more gems in your fork. I'm happy to merge them. |
Hello, and thanks for this neat and useful toolchain. I'm trying to do a better job of managing my OpenWRT-based router and APs, and as a confirmed Nixaholic this repository is just what I needed.
Would you be interested in a PR introducing a modular interface to the OpenWRT image builder code? I have a (very) rough cut at such an interface up on SourceHut here.
The high-level view:
If specified as a flake output, the image and associated assets could then be built with
nix build '.#openwrtImages.default.config.system.build.image'
. I plan to add a wrapper command for this that would permit doing, say,nix-openwrt-imagebuild '.#default'
.Any interest in integrating something like this in your project?
Thank you!
The text was updated successfully, but these errors were encountered: