Jump to content

Dual Booting NixOS and Windows: Difference between revisions

Add proper sections
(→‎Autodetection with os-prober: add note about systemd-boot)
(Add proper sections)
Line 1: Line 1:
= Bootloader =
This section explains various methods to have the bootloader prompt whether to boot windows or NixOS.


This section explains various methods to have the bootloader prompt whether to boot windows or NixOS.
== Autodetection ==


== Autodetection with 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.
If <code>\EFI\Microsoft\Boot\bootmgfw.efi</code> is detected on the EFI System Partition (ESP), it will be loaded by systemd-boot automatically.
Therefore, on EFI systems, it may be simplest to resize the existing ESP to at least 500 megabytes, and share that ESP for NixOS.
Therefore, on EFI systems, it may be simplest to resize the existing ESP to at least 500 megabytes, and share that ESP for NixOS.


== Autodetection with os-prober ==
=== os-prober ===


<code>os-prober</code> is a tool to autodetect which other systems are present on the machine. Grub can be
<code>os-prober</code> is a tool to autodetect which other systems are present on the machine. Grub can be
Line 23: Line 23:
}</nowiki>}}
}</nowiki>}}


== Manual bootloader configuration ==
== Manual configuration ==
In case <code>os-prober</code> does not detect your windows partition you can configure your bootloader manually to find it.
In case <code>os-prober</code> does not detect your windows partition you can configure your bootloader manually to find it.


Line 30: Line 30:
All MBR bootloaders will need at least some configuration to chainload Windows.
All MBR bootloaders will need at least some configuration to chainload Windows.


==== Grub ====
==== Grub ====


Here is an example config:
Here is an example config:
Line 47: Line 47:
Source: https://www.reddit.com/r/NixOS/comments/31lx3i/windows_and_nixos_dual_boot/
Source: https://www.reddit.com/r/NixOS/comments/31lx3i/windows_and_nixos_dual_boot/


=== EFI ===
=== UEFI ===


After setting up a 256mb EFI Partition dualboot should work out of the box (at least for windows10)
After setting up a 256mb EFI Partition dualboot should work out of the box (at least for windows10)
Line 119: Line 119:
}</nowiki>}}
}</nowiki>}}


= System time =
== System time ==


System clock might be incorrect after booting Windows and going back to the NixOS. It can be fixed by either setting RTC time standard to UTC on Windows, or setting it to localtime on NixOS.
System clock might be incorrect after booting Windows and going back to the NixOS. It can be fixed by either setting RTC time standard to UTC on Windows, or setting it to localtime on NixOS.
Line 132: Line 132:
}</nowiki>}}
}</nowiki>}}


Sources:
See [https://wiki.archlinux.org/title/System_time#Time_standard Arch Linux wiki#System time].
* [https://wiki.archlinux.org/title/System_time#Time_standard Arch Wiki  - System time - Time standard]
 
* [https://wiki.archlinux.org/index.php/GRUB#Windows_installed_in_UEFI-GPT_Mode_menu_entry Arch Wiki GRUB article]
== See also ==
* [https://wiki.archlinux.org/index.php/GRUB#Windows_installed_in_UEFI-GPT_Mode_menu_entry Arch Linux wiki#GRUB]
* [https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/loader/grub/install-grub.pl NixOS GRUB installer] (check the code block beginning with <nowiki># install EFI GRUB</nowiki>)
* [https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/loader/grub/install-grub.pl NixOS GRUB installer] (check the code block beginning with <nowiki># install EFI GRUB</nowiki>)


[[Category:Cookbook]]
[[Category:Cookbook]][[Category:NixOS]]
142

edits