Dual-boot with windows 11, 100MB EFI partition

I want to install NixOS alongside a Windows install that occupies the primary partitions

I already tried it, original EFI partition being windows only, with a separate unencrypted EXT4 /boot partition of 2GB and the rest being encrypted BTRFS but the result was not bootable.

I guess I want to add an efi shim or something to the existing efi partition, without breaking windows in any way.

Systemd-boot should be used so no “grub booting windows” stuff, switching just inside the bios I guess.

But if grub or limine would be used that would be okay too I guess, as long as grub doesnt decrypt the main partition which is way too slow.

Your EFI firmware doesn’t support ext4. A separate boot works using boot.loader.systemd-boot.xbootldrMountPoint, it will require an EFI driver. You can try to get a driver from the GNU GRUB project or EfiFs, but the easiest way is to reformat /boot to vfat (FAT32 will give you some sort of minimum size requirement warning, but it seems it’s okay to ignore it).

Does Btrfs support encryption now? Or is it Btrfs on LUKS?

I tried doing this recently since alongside ZFS, I wanted a more modern FS, not crusty, old FAT32. I checked my EFI firmware & saw only FAT16 & FAT32 were supported. I could have bothered, but gave up since the drivers aren’t packaged in Nixpkgs already, I didn’t feel like doing the packaging, & it seem to just incur some extra friction + a future failure point or security hole.

Just to be clear, xbootldrMountPoint does not require an EFI driver. That’s only the case if you choose to use something like ext4 for it. But you can have a FAT32 ESP at /efi and a FAT32 XBOOTLDR at /boot (which must be configured in nixos with boot.loader.efi.efiSysMountPoint and boot.loader.systemd-boot.xbootldrMountPoint respectively) and that does not require any driver. Dealing with the 100MB ESP from Windows without reformatting the ESP is primary motivation for supporting this layout, so this is a pretty normal setup.

2 Likes

Good catch. I didn’t reread my thought. Spec says FAT32 needs to be supported. Technically boards could ship with additional FS support drivers built in, but almost never happens (& would would it be for those pesky Linux users?).

It’s actually extremely common for boards to support NTFS as well. I’ve gone as far as booting NixOS using NTFS for NixOS’s root FS and using that same NTFS for the ESP (i.e. efiSysMountPoint = "/";). It was only an experiment; please do not do this ever :stuck_out_tongue:

Also, technically EDK2, which most boards are using for their UEFI implementation, even supports UDF and more recently ext4. But of course ext4 isn’t really something any board vendors have an interest in shipping, and it’s too new to have been tried by any vendors anyway.


Anyway that’s all just cool side information. Regular users of NixOS should just use FAT32 for the ESP, and FAT32 for XBOOTLDR if their ESP is too small.

2 Likes

NTFS

I didn’t bother trying this one… pretty obvious reasons :joy:. It’s a shame ext2 or ext4 aren’t normalized.

1 Like