Dual Booting NixOS and Windows: Difference between revisions

(→‎systemd-boot: mention bootctl)
(→‎systemd-boot: Mention xbootldr)
Line 5: Line 5:
=== systemd-boot ===
=== systemd-boot ===


{{ic|systemd-boot}} will automatically detect an Windows installation ({{ic|/EFI/Microsoft/Boot/bootmgfw.efi}}) present on the EFI System Partition (ESP) and add it as a boot option.
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.


You can verify detected boot loaders by running the {{ic|bootctl}} command.
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 ===