-
-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/systemd-boot: Simpler windows dual booting #344327
Conversation
b1f9b9b
to
f15c446
Compare
@JulienMalka I'm tagging you as maintainer of the memtest and netboot tests, @r-vdp as you added the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diff LGTM!
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-already-reviewed/2617/1980 |
3fc05ed
to
e713dd1
Compare
@ofborg build systemd-boot.edk2-uefi-shell systemd-boot.windows Edit: whoops wrong command 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works on my machine
LGTM
@ofborg test systemd-boot.edk2-uefi-shell systemd-boot.windows |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-already-reviewed/2617/2031 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diff generally LGTM and having the option makes sense.
Btw, whatever autoformatter you used, it's not nixfmt-rfc-style. I'd recommend you fix that as that will be the only valid one in the not too distant future.
We already have a edk2-uefi-shell package in nixpkgs, but adding it to systemd-boot was somewhat tedious. Now it's a single line of nix.
When installing NixOS on a machine with Windows, the "easiest" solution to dual-boot is re-using the existing EFI System Partition (ESP), which allows systemd-boot to detect Windows automatically. However, if there are multiple ESPs, maybe even on multiple disks, systemd-boot is unable to detect the other OSes, and you either have to use Grub and os-prober, or do a tedious manual configuration as described in the wiki: https://wiki.nixos.org/w/index.php?title=Dual_Booting_NixOS_and_Windows&redirect=no#EFI_with_multiple_disks This commit automates and documents this properly so only a single line like boot.loader.systemd-boot.windows."10".efiDeviceHandle = "HD0c2"; is required. In the future, we might want to try automatically detecting this during installation, but finding the correct device handle while the kernel is running is tricky.
e713dd1
to
73011ba
Compare
Yeah I don't remember tbh, but I reformatted it with the latest version of nixfmt-rfc-style now. |
@ofborg test systemd-boot.edk2-uefi-shell systemd-boot.windows |
Description of changes
When installing NixOS on a machine with Windows, the "easiest" solution
to dual-boot is re-using the existing EFI System Partition (ESP),
which allows systemd-boot to detect Windows automatically.
However, if there are multiple ESPs, maybe even on multiple disks,
systemd-boot is unable to detect the other OSes, and you either have to
use Grub and os-prober, or do a tedious manual configuration as
described in the wiki:
https://wiki.nixos.org/w/index.php?title=Dual_Booting_NixOS_and_Windows&redirect=no#EFI_with_multiple_disks
This commit automates and documents this properly so only a single line
like
is required.
In the future, we might want to try automatically detecting this
during installation, but finding the correct device handle while the
kernel is running is tricky.
This is not something we can rely on systemd-boot to fix, the issue about this has been open for years.
In addition, this PR also adds an option to add a boot-entry for edk2-uefi-shell, which is required to find the correct value for
efiDeviceHandle
and is generally useful for debugging and tinkering.I also took the liberty of autoformatting, which was done in a separate commit to make review easier.
I'm uncertain if this change is significant enough to warrant a release-note.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.