my configuration looks like this. I just let OSProber find it for me.
The manual way lets you rebuild NixOS more quickly, but if you run into issues (as I did) you can just fall back to this lazy solution
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
grub = {
enable = true;
devices = [ "nodev" ];
efiSupport = true;
useOSProber = true;
};
};