NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.32k stars 14.29k forks source link

Add support for custom menus in `iso-image.nix` #338738

Open BrainWart opened 2 months ago

BrainWart commented 2 months ago

I would like to see the ability to add custom menu entries in the installer.

Suggestion:

isoImage.grubMenu = [
  { title = "My Custom Menu Item";
    type = "menuentry";
    config = pkgs.writeText "custom-grub-menu" ''
      linux ...
      initrd ...
      devicetree ...
    '';
  }
  { title = "My Custom Submenu";
    type = "submenu";
    config = pkgs.writeText "custom-grub-submenu" ''
      menuentry 'custom item 1' {
        ...
      }
      ...
    '';
  }
];
andrewbaxter commented 2 months ago

I'd like this a lot too, but maybe for some background on my use case.

I create a lot of live usbs for various systems and while Nix already has a lot of image builders, AFAICT the only liveusb/cd functionality is the installer iso creator. That works fine and isn't tightly coupled to actually creating an installer in any way except all the menu items/branding/etc refer to "NixOS Installer" or whatever.

In my case I had forked iso-image.nix with modifications, but yesterday I had a system that took 15m+ to boot when using my forked version (some outdated kernel command line flags?) so switched back.

That said, if I can expand the scope slightly, stuff like being able to change the default timeout (-> have no menu) and modify the image contents would be great. Maybe a base iso/usb image builder could be created, and the installer could build upon that. (I'd also like to remove the nix store overlay from filesystems since I don't want a mutable install, however temporarily, but that's pretty minor).