For ages I wanted a clean dual‑boot between Windows 11 (for the few things that require it) and NixOS (for everything I actually enjoy). This is the full journey: GParted wizardry, fixing MBR/GPT issues, laying out a big EFI (because NixOS loves EFI space), and finishing with flakes.


Step 1 — Disk Layout in GParted

I booted a live USB with GParted and created the following:

  • EFI System Partition (ESP): 1030 MB, FAT32, flags boot, esp
  • Windows: 200 GB, NTFS
  • Linux swap: 8 GB
  • Linux root: rest of the disk (later Btrfs)

Why a big ESP? NixOS + systemd‑boot keeps multiple generations of kernels/initrds. A tiny 100 MB ESP fills up fast.

Step 2 — Windows 11 Install (and the MBR → GPT Fix)

Windows initially refused to install with the classic message:

“The selected disk has an MBR partition table. On EFI systems, Windows can only be installed to GPT disks.”

The fix: press Shift + F10 in the installer to open a command prompt and run diskpart:

diskpart
select disk 0 # use your install disk
clean
convert gpt

create partition efi size=1030
format quick fs=fat32 label="EFI"
assign letter=S

create partition msr size=16

create partition primary size=200000
format quick fs=ntfs label="Windows"
assign letter=W
exit

Back in the GUI, I selected the 200 GB NTFS partition and installation proceeded normally.

Step 3 — NixOS Minimal with Btrfs + Subvolumes

After Windows finished, I installed NixOS from the minimal ISO, reusing the same 1 GB ESP.

Format & subvolumes

# Swap (8 GB) and Btrfs (rest) were created as p4 and p5
mkswap /dev/nvme0n1p4
swapon /dev/nvme0n1p4

mkfs.btrfs -f -L nixos-root /dev/nvme0n1p5

# Create subvolumes
mount /dev/nvme0n1p5 /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@nix
btrfs subvolume create /mnt/@log
umount /mnt

Mounts for install

mount -o subvol=@,compress=zstd,noatime /dev/disk/by-label/nixos-root /mnt
mkdir -p /mnt/{home,nix,var/log,boot/efi}
mount -o subvol=@home,compress=zstd,noatime /dev/disk/by-label/nixos-root /mnt/home
mount -o subvol=@nix,compress=zstd,noatime /dev/disk/by-label/nixos-root /mnt/nix
mount -o subvol=@log,noatime /dev/disk/by-label/nixos-root /mnt/var/log

mount /dev/disk/by-label/EFI /mnt/boot/efi
swapon /dev/disk/by-label/swap
Final partition map: EFI (1G), MSR (16M), Win (200G), swap (8G), NixOS (Btrfs).

Step 4 — Flakes + Local Clone

I cloned my flake locally into /mnt/etc/nixos (SSH keys already added to GitHub):

nix-shell -p git openssh
git clone git@github.com:YOURUSER/YOUR-REPO.git /mnt/etc/nixos
nixos-generate-config --root /mnt
# copy the fresh hardware config into my host dir
cp /mnt/etc/nixos/hardware-configuration.nix /mnt/etc/nixos/hosts/<hostname/

Because it’s a local path flake, I installed with --impure:

nixos-install --impure --flake /mnt/etc/nixos#<hostname>

The Final Gotcha: git push or Bust

One last wrinkle: the build would not succeed until I committed and pushed my changes (notably the new hardware-configuration.nix) to GitHub. After staging and pushing, the install finished flawlessly.

cd /mnt/etc/nixos
git add .
git commit -m "Add hardware config for <hostname>"
git push

5. Disable Fast Startup in Windows Before Dual Booting

When setting up a dual boot between Windows 11 and NixOS, one common pitfall is Windows’ Fast Startup feature (sometimes called Fast Boot).

  • Linux sees the Windows partitions (including the EFI system partition) as “dirty” or hibernated.
  • This prevents Linux from properly mounting the EFI partition or NTFS drives.
  • As a result, nixos-install may fail to install the bootloader, or your Windows partition will mount read-only inside Linux.

👉 Solution: Disable Fast Startup before installing NixOS.

Steps in Windows 11

  1. Open Control Panel → Hardware and Sound → Power Options.
  2. Click Choose what the power buttons do.
  3. Select Change settings that are currently unavailable.
  4. Uncheck Turn on fast startup (recommended).
  5. Save and reboot once.

Also run this in Windows PowerShell (Admin) to fully disable hibernation:


powercfg /h off

🔍 Linux: Check if Windows is Still Hibernated

From a NixOS live USB (or any Linux environment), you can check if Windows partitions are still marked as hibernated:


lsblk -f
# find your Windows NTFS partition, e.g. /dev/nvme0n1p3

sudo ntfsfix -n /dev/nvme0n1p3

If you see Volume is hibernated, it means Fast Startup or hibernation is still active. Boot back into Windows, make sure Fast Startup is disabled, and shut down completely (not restart).


✅ With Fast Startup disabled, both operating systems can safely share the EFI partition and see each other’s filesystems without corruption risks.

Conclusion

  • Convert to GPT for UEFI Windows installs.
  • Use a large ESP (≈1 GB) so systemd‑boot has space for generations.
  • Btrfs subvolumes keep NixOS tidy and snappy.
  • With flakes, remember: commit & git push before installing.
  • Disable fast boot in win 11

Note: AI used for writing this blogpost