Dual boot Windows / Nixos with different efi partition

I installed NixOS on my laptop which also has Windows 10.
However, because I remembered from last time I did this that the boot partition tends to get filled up with nixos generations, I instead created an additional EFI partition of 1 GB in size ( I didn’t want to touch the one that has windows on it, also it’s difficult to resize it due to other partition after it)

This works, but unfortunately it means that NixOS doesn’t see my windows partition upon boot and so doesn’t provide an option to boot from. I can boot Windows by selecting it in the BIOS but it’s kind of a hassle.

Is it possible to add the entries manually in the NixOS configuration, so that when booting I do get the option ?

Currently, my configuration.nix is set to.
boot.loader.systemd-boot.enable = true;

I did find the extraEntries setting here boot.loader.systemd-boot.extraEntries
but I’m not sure how to use it to point to a different efi partition

My partition table looks as following :
/dev/nvme0n1p1 : EFI partition for Windows , about 100 MB
/dev/nvme0n1p2 : Microsoft reserved , 16MB
/dev/nvme0n1p3 : Windows 10 main partition
/dev/nvme0n1p4 : EFI partition for NixOS, about 1 GB
/dev/nvme0n1p5 : NixOS main partition

So is it possible to add an entry to the nixos configuration which allows me to boot the windows efi on
Or if you have any other solutions ? I’d just prefer not reinstall everything :wink:

My NixOS version is 23.11

Let me know if you need more information

Kind regards,

Assuming you’re using systemd-boot, you can put just systemd-boot on the windows EFI partition and use a separate “XBOOTLDR” partition for it to find all the generation files on. Basically, you mount the windows EFI partition to /efi and set boot.loader.efi.efiSysMountPoint = "/efi";, and you mount your XBOOTLDR partition to /boot and set boot.loader.systemd-boot.xbootldrMountPoint = "/boot"; This does mean that this XBOOTLDR partition needs its GPT type code set to the XBOOTLDR type code, rather than setting it to the ESP type code, since that’s how systemd-boot finds it.

Note this feature is only available on nixos-unstable, and not 23.11.


Some directions there maybe Dual Booting NixOS and Windows - NixOS Wiki

sudo mount /dev/nvme0n1p1 /mnt
sudo cp -r /mnt/Microsoft /boot/EFI/
sudo nixos-rebuild boot

I described the XBOOTLDR solution because it’s sort of the “right” way to handle this situation, where windows has a tiny ESP and you still want to boot alongside it.

The old wiki doesn’t really have anything for this.

You don’t want to just copy windows’s ESP to another ESP because then it won’t be updated along with windows.

Ok, so if I understand correctly the best solution is to configure the seperate XBOOTLDR.
However, this is currently only available on nixos-unstable.

What are the risks with moving to unstable ?

Kind regards,

It’s described a little bit here: NixOS Manual

I dunno if I’d 100% agree with not using unstable for production systems, depending on your circumstances. But it’s true that it regularly sees large amounts of package updates and potentially even changes to the nixos options.

1 Like