Jump to content

Dual Booting NixOS and Windows: Difference between revisions

→‎Grub: Remove old info
(→‎System time: more concise)
(→‎Grub: Remove old info)
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
=== systemd-boot ===
=== systemd-boot ===


If <code>\EFI\Microsoft\Boot\bootmgfw.efi</code> is detected on the EFI System Partition (ESP), it will be loaded by systemd-boot automatically.
When {{ic|systemd-boot}} is installed to the same EFI System Partition (ESP) that Windows uses, it will automatically detect the Windows installation ({{ic|/EFI/Microsoft/Boot/bootmgfw.efi}}) and present it as a boot option.
Therefore, on EFI systems, it may be simplest to resize the existing ESP to at least 500 megabytes, and share that ESP for NixOS.
 
You can verify detected boot loaders by running the {{ic|bootctl}} command.
 
A system pre-installed with Windows might have a small ESP partition size that is not sufficient to store the kernel and initrd files for multiple NixOS generations. One solution is to create an additional [https://uapi-group.org/specifications/specs/boot_loader_specification/#the-partitions XBOOTLDR] partition and configure {{ic|systemd-boot}} to use it:
 
{{File|/etc/nixos/configuration.nix|nix|<nowiki>
{
  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/57D4-A2B2";
      fsType = "vfat";
    };
  fileSystems."/efi" =
    { device = "/dev/disk/by-uuid/3280-5418";
      fsType = "vfat";
    };
 
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
 
  boot.loader.efi.efiSysMountPoint = "/efi";
  boot.loader.systemd-boot.xbootldrMountPoint = "/boot";
}
</nowiki>}}


=== os-prober ===
=== os-prober ===
Line 56: Line 78:


==== Grub ====
==== Grub ====
<nowiki>systemd-boot</nowiki> can not load EFI binaries from other partitions,
and a pre-existing EFI partition from a Windows install may be smaller than we would like our <nowiki>/boot</nowiki> partition to be. If we still want Windows and NixOS to use the same EFI partition, we can use GRUB instead.


Here we assume:
Here we assume:
142

edits