Osprober takes several minutes


I’ve installed recently a new nvme drive next to my previous SATA devices, I moved my nixos install to this nvme drive and the os-prober part of nixos-rebuild that used to take I dunno, 5-10 sec now takes a minute at least (for ~4 drives, a dual boot nixos/windows). It’s quite annoying as I nixos-rebuild several times a day for nix development.

updating GRUB 2 menu...
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
lsblk: /dev/mapper/no*[0-9]: not a block device
lsblk: /dev/mapper/raid*[0-9]: not a block device
lsblk: /dev/mapper/disks*[0-9]: not a block device
Found Windows Boot Manager on /dev/nvme0n1p3@/EFI/Microsoft/Boot/bootmgfw.efi
Found NixOS 24.05 (Uakari) (24.05) on /dev/sda7
activating the configuration...

My question is how to fix/workaround that to make my nixos-rebuild faster.

  1. I’ve seen there is boot.loader.grub.useOSProber option. Wont disabling osprober make my windows boot disappear ?
  2. maybe I can hardcode some of the currently generated grub configuration and only then disable osprober. My physical configuration doesn’t change much (it was the first time I changed a drive in years) , can’t the osprober be set to run manually instead ?
  3. would the systemd booter be better ?