NixOS managed grub not detecting another distribution (Fedora)

I have Fedora, Windows, and Nix triple booted on my home workstation now (gradually migrating my life to Nix), however, Grub refuses to detect my Fedora grub entries (it detects Windows). I can manually boot via UEFI into Fedora’s Grub, which likewise does not detect Nix (It also detects windows).

The settings I used were:

boot.loader.systemd-boot.enable = false;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "nodev";
boot.loader.grub.efiSupport = true;
boot.loader.grub.useOSProber = true;

My partition scheme is the default fedora partitioning, with 100 MB Fat formatted EFI partition, a 1 gb ext4 boot partition created by fedora (EFI is mounted as a subfolder at /boot/EFI matching Fedora).

Has anyone circumvented this problem? I’m aware that I can manually add entries to grub.

Ok, I ended up figuring something out so I thought I would share!

OS prober adds several minutes to rebuild for me and also fails to detect fedora. This might be because fedora install grubs in it’s EFI folder and not under /boot. I manually added the following extraEntries to grub in my configuration.nix

  boot.loader.grub.extraEntries = ''
	menuentry "Windows Boot Manager (on /dev/nvme0n1p2)" --class windows --class os {
		insmod part_gpt
		insmod fat
		search --no-floppy --fs-uuid --set=root 40E2-A3BF
		chainloader /EFI/Microsoft/Boot/bootmgfw.efi
	}

	menuentry "Fedora" --class fedora --class os {
		insmod part_gpt
		insmod ext2
		insmod fat
		search --no-floppy --fs-uuid --set=root 40E2-A3BF
		chainloader /EFI/fedora/grubx64.efi
	}
'';

Note, this chains one grub into another, rather than letting you directly launch fedora, but to me this seems like a fine compromise. I tried directly loading grub directly which did not work;

menuentry "Fedora" --class fedora --class os  {
    insmod part_gpt
    insmod ext2
    insmod fat
    set root=PART_UUID=40E2-A3BF
    configfile /EFI/fedora/grub.cfg
}