Repairing boot menu

I installed Fedora Silverblue to try the new version on my system with NixOS. SB doesn’t play well with pre-existing efi directories, and in the process, I reformatted the efi partion and the boot entries associated with NixOS are gone. Running grub2-mkconfig from SB does not find the NixOS images unfortunately.

I’m not very handy with grub, and am looking for some advice. I guess I could do a fresh NixOS install and rebuild with my configs, but it seems there should be a better way. I’d appreciate some advice.

Thanks

There’s nothing to find, you wiped the ESP. Just boot the NixOS ISO, mount up your file systems, and run nixos-install. The cool thing about nixos-install is that it’s idempotent; you can run it on an already installed system and all it’ll do is make sure it’s installed correctly.

Also, NixOS generally wants to be the one in charge of the boot loader, because one of its hallmark features is being able to roll back to any generation in the boot menu.

Boot again from the nixos installer iso/isb.

Mount the filesystems as you would during an install, under /mnt`

Then either:

nixos-enter --root /mnt
nixos-rebuild switch --install-bootloader

or

nixos-install --root /mnt --no-root-password

Thank you all for the helpful replies.

Silverblue is also particular about controlling efi (it cannot even be installed using a pre-existing efi, though Fed Workstation can). So my question is, should I perform the above procedure using a separate efi partition or the same as SB? Will I be able to boot SB from the NixOS efi partition? I am asking the same thing in the Fedora channels, along with some other questions about booting oddities.

Also, could I perform the above procedure by chrooting from my running OS?

Cheers