nix-openwrt-imagebuilder icon indicating copy to clipboard operation
nix-openwrt-imagebuilder copied to clipboard

Add module builder

Open pedorich-n opened this issue 1 year ago • 10 comments

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

pedorich-n avatar Dec 01 '24 11:12 pedorich-n

Cc: @ehmry @adamcstephens @makisekurisu

astro avatar Dec 01 '24 13:12 astro

I'd like to review but I haven't been using the imagebuilder (or openwrt).

ghost avatar Dec 02 '24 10:12 ghost

I like this. Please feel encouraged to follow through.

astro avatar Dec 27 '24 01:12 astro

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.

pedorich-n avatar Dec 27 '24 15:12 pedorich-n

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.

pedorich-n avatar Jan 05 '25 07:01 pedorich-n

Is there any chance I could get a review @SuperSandro2000 @astro ? 👀

pedorich-n avatar Feb 09 '25 06:02 pedorich-n

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 😓

SuperSandro2000 avatar Feb 17 '25 19:02 SuperSandro2000

Me and @marcelcoding have some interest in using this for future infrastructure. Hopefully we find some time bringing this forward together.

SuperSandro2000 avatar Apr 28 '25 12:04 SuperSandro2000

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.

pedorich-n avatar Apr 28 '25 12:04 pedorich-n

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)

MarcelCoding avatar May 03 '25 17:05 MarcelCoding