Submenus to group specialisations of generations: Switch your bootloader to one that supports submenus. This feature is implemented in Nix bootloader modules where possible. Options:
Submenus to group arbitrary specialisations together, within one generation: NixOS currently doesn’t have options for this.
Opportunities for contribution:
There’s a (currently open) PR for systemd-boot that implements automatic submenus. It may allow Nix-generation submenus in the future, but not necessarily grouped specialisations. Credit to @ElvishJerricco for linking this.
The best-supported non-GRUB bootloader in Nixpkgs that supports customizable submenus seems to be Limine, though customizing the submenus is not implemented in the Nix options (yet).
If you want to contribute, look further in this thread.
Unless there’s a better place for discussing NixOS module development, I’m going to leave this discussion open for now.
Each submenu is a config; entering a submenu is loading or chainloading this config (you can also use the same to go up); and there are also normal entries.
Sure, I meant moreso how would that actually be implemented? systemd-boot, for instance, just displays all $ESP/loader/entries/*.conf entries, so there’s no way to chainload another systemd-boot and tell it to show a different set of entries.
Since you mentioned limine, it does support multi-level nesting.
I’m not sure whether NixOS itself handles it that way with the limine module… but some changes can be made there if not.
I don’t see any explicit NixOS configuration options for that under boot.loader.limine, but I’ll try switching to Limine to see if it groups generations by default.
Yeah there’s no option for it, I meant if it doesn’t work it’d have to be changed in nixpkgs (or via disabledModules and co.) Curious to know if it works since I’d use it too.
I tried booting with Limine, and NixOS does use Limine’s submenu feature by default for generations. However, none of the configuration options can be used to manually bring in custom submenus.
It is possible that you want to look at RFC42 (in the sense that a PR adding all the options one by one explicitly might get more scrutiny than «let’s switch to a more overridable style and then the end user can add all the options»)
For custom-defined specialisation ‘categories’, or submenus, I imagine we’d have to add the relevant data to bootspec and add general (not bootloader-specific) options for it (maybe under system or boot?)
I’m not going to try modifying the bootspec (for categories) yet, but I’ve opened a PR with some smaller tweaks. If you’d like, let me know what you think.
That PR is currently in draft. I’ll work on it maybe Friday/Sunday this week.
EDIT: I closed the PR as the changes it suggests can be better solved another way, that also allows the specialisation grouping. More on that in my reply below.
Overriding this on specific specialisations would only affect where those specialisations end up on the menu.
For example:
boot.submenus = [ "Boot-entry Group 2" ]
Assuming specialisation.<name>.inheritParentConfig = true, this would append "Boot-entry Group 2" to the list, putting that specialisation in its own submenu.
If another specialisation does the same, and the name of the submenu is identical, they are both grouped into the same one.