boot.loader.grub.devicehas to be set to nodev, otherwise the grub installer will assume it has to install the Legacy (MBR) bits too. When doing so, it will either embed itself into the “unused” part of an MBR formatted disk, or require that bios boot partition.
That is, assuming you indeed want to install grub only to boot using UEFI.
The install also works if I use "nodev" and remove the canTouchEfiVariables option. This time it works without the bios_grub partition. I see this as an absolute win.
However, I don’t understand entirely what happened. Or, rather, I don’t understand the nomenclature. Why does "nodev" mean uefi only? Why isn’t efiSupport = true sufficient?
Absolute fucking mysteries.
But the nixos user community seems pretty awesome. A couple of folks offered persistent help on the subreddit and @samueldr replied here. So, guess I’ll keep plugging.
The main thing is that “nodev” means “don’t install grub to a device”, which is only a thing that can be done for legacy boot. Not sure why efiSupport isn’t sufficient, but the behaviour should make it possible to install grub both as UEFI and MBR at once, which is likely the reason for some of its idiosyncracies.
Are you doing this in virtualbox? Virtualbox doesn’t persist NVRAM, so boot.loader.grub.efiInstallAsRemovable has to be true, and/or boot.loader.efi.canTouchEfiVariables has to be false. That should work on any system. Setting the inverse should work on any system with working NVRAM though, and allow multiple OSes in the ESP.
Just chiming in to say that @ElvishJerricco’s suggestion about VirtualBox applies to Parallels, as well. I set boot.loader.grub.efiInstallAsRemovable to true and my virtual machine now works.
It’s possible that the hardware.parallels.enable option configures this, as well, but I don’t have it set as it’s currently broken.