Additional Customized NixOS Grub Entries

I am looking for a way to create additional grub entries based on the default NixOS ones. The goal is to select at boot time whether NixOS should be started natively or as a guest for my custom hypervisor. Hence, I am searching for a way to duplicate and wrap NixOS grub entries.

Native entries (generated by install-grub.pl) look like this:

linux $kernel $kernelParams
initrd $initrd

For each of these entries, I’d like to have an additional entry:

multiboot $loader
module $hypervisor $hypervisorParams
module $kernel $kernelParams
module $initrd

There is already a xen path in the perl script which creates a config similar to the one I am looking for. My needs differ slightly because hypervisor entries should exist in addition to the native ones and I’d like to use more than one additional multiboot module and parameters. Adding another hypervisor path to the perl script would probably not be useful for the community which is why I am thinking of turning the existing xen approach into a more generic solution.

Has anybody done something similar before and can offer some pointers especially on how to duplicate grub entries?

I know how you can add another Grub Entry with a different configuration.nix.
I believe it’s nesting.clone NixOS Search.
Not certain that’s the answer you’re looking for though.

1 Like