NixOS & OpenWRT are my two. NixOS’s Nix language as declarative config is such a great tool for setting up & maintaining a machines for the long-term that despite the initial learning curve has paid off in the long run (Guix or a Nix successor should also be in the same category). OpenWRT is the purpose-built tool it is for having an OS for a router with low overhead & a UI that can be easier to understand the config when networking isn’t something you do on the regular.
I do this with my kernel & a couple of applications that either compile super fast anyhow or at runtime benefit from further compiler optimizations.