Add module builder
This PR adds a module interface to the builder derivation. This brings benefits such as strict options definition, better type-checks, and flexibility for future improvements or modifications. I left the old builder in place for backward compatibility. In the future, it could be removed, and an "adapter" could be installed to convert old inputs into the new module system and maintain backward compatibility.
The module is inspired by @tomeon's nix-openwrt-imagebuilder-module project, but it's structured differently and the module itself is simpler. Please let me know if you feel it isn't fair to your work.
Opening this as a draft to gather opinions.
If everything is fine I will add module documentation and update README to tell users to use build-module in a follow-up PR to not pollute this one.
I also moved examples into a dedicated folder, since we have 4 of them now.
Closes #22
Cc: @ehmry @adamcstephens @makisekurisu
I'd like to review but I haven't been using the imagebuilder (or openwrt).
I like this. Please feel encouraged to follow through.
Thanks for your encouragement, @astro !
I've updated the docs module, exposing both markdown and json. At a certain iteration, I realized it looked almost like https://github.com/astro/microvm.nix/blob/2ae08de8e8068b00193b9cfbc0acc9dfdda03181/pkgs/doc.nix, so I just copied most of the stuff from there 😅 @SuperSandro2000 please have a look.
I also added support for "separate Kmods" and tested the build with both "old" (23.05.5) and "new" (24.10.0-rc4) versions. Builds fine.
Happy New Year everybody!
I've added a new package to generate/update module docs and a GitHub flow to do it from GHA. I've also updated the documentation with a minimal example and a recommendation to use the builder module over the builder function.
I think this PR is ready for a proper review now.
Is there any chance I could get a review @SuperSandro2000 @astro ? 👀
I would really need to try this to know fore sure if it works perfectly but I am not keen on bricking my router right now in case of any issues 😓
Me and @marcelcoding have some interest in using this for future infrastructure. Hopefully we find some time bringing this forward together.
I'm sorry I haven't been active. I really want to see this working, but I struggled to find the willpower to get back to it. The changes in this PR have grown quite large, and being asked to completely replace existing code within the same PR became overwhelming for me.
I'd still love to help if we can find a way to contribute incrementally.
I've successfully deployed my testing AP using this PR in https://gitea.c3d2.de/zentralwerk/network/src/branch/openwrt-module. (I've used my fork to get up-to-date hashes)