Dual-booting NixOS with Fedora Silverblue

Hey all,

I’m trying NixOS out, so I ran the installer and chose to resize my Fedora Silverblue 36 partition and install NixOS to the side. The result looks like this:

Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1       2048    1230847    1228800   600M EFI System
/dev/nvme0n1p2    1230848    3327999    2097152     1G Linux filesystem
/dev/nvme0n1p3    3328000 1955178496 1951850497 930,7G Linux filesystem
/dev/nvme0n1p4 1955178498 3907028991 1951850494 930,7G Linux filesystem

Fedora is on /dev/nvme0n1p3, NixOS is on /dev/nvme0n1p4. The EFI partition does have a /nixos folder on it.

Once NixOS set up was complete, the computer restarted (well, actually, it failed to restart and just hung, so I ended up power cycling manually), and I was presented with Fedora’s GRUB2 boot menu and no option to start NixOS.

I’ve run grub2-mkconfig and, interestingly enough, it detects NixOS:

[fedora ~]$ sudo grub2-mkconfig -o /etc/grub2-efi.cfg
Generating grub configuration file ...
Found NixOS 22.05 (Quokka) (22.05) on /dev/nvme0n1p4
Found Windows Boot Manager on /dev/sdc2@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done

But it doesn’t add it to the boot menu. I’ve dug into the grub shell scripts a bit, and it seems that os-prober does detect NixOS, but linux-boot-prober, which is supposed to actually figure out how to boot a different linux system, doesn’t figure it out. To be fair, I mounted the NixOS partition to look around and I can’t figure it out either but then again I know little about how Linux boots :stuck_out_tongue:

Before I dig into it more, I wanted to ask if anyone has some tips/experience with this. I also asked the Fedora community.

If I wanted to configure grub manually to boot NixOS in this set up, how would I do it? (I’m sorry, I know very little about how grub works so I’m having trouble even searching for this)

NixOS needs to control the bootloader to implement its bootloader rollbacks feature. It needs to pass the nix store path of the system generation to the kernel. If you want nixos to share with another OS, you have 3 options I’m aware of:

  • Use your firmware’s boot selection menu to choose between the nixos bootloader and the other operating system’s bootloader.
  • Let nixos control the bootloader and detect the other OS’s
  • Let nixos control a secondary bootloader which is called from the other OS’s bootloader, or the other way around.
2 Likes