Prerequisites
Before you begin, ensure you have:- A computer with UEFI firmware (not legacy BIOS)
- Windows already installed (or space to install it)
- At least 50GB of free disk space for NixOS
- A USB drive for the NixOS installer (8GB or larger)
- Backup of important data
Installation order
It’s recommended to install Windows first, then NixOS. Windows tends to overwrite bootloaders, so installing it last can cause issues.
Prepare your system
Disable Fast Startup in Windows
Fast Startup can cause issues with dual booting:
- Open Control Panel → Power Options
- Click “Choose what the power buttons do”
- Click “Change settings that are currently unavailable”
- Uncheck “Turn on fast startup”
- Save changes
Shrink Windows partition
Create space for NixOS:
- Press Win+X and select “Disk Management”
- Right-click your C: drive
- Select “Shrink Volume”
- Enter the amount to shrink (at least 50000 MB for a comfortable installation)
- Click “Shrink”
Install NixOS
Follow the NixOS installation guide to install NixOS in the unallocated space. During installation:- Use the existing EFI partition (created by Windows)
- Don’t format the EFI partition
- Create your Linux partitions in the unallocated space
Configure secure boot
After NixOS is installed and working, configure secure boot using Lanzaboote:Enable secure boot in your configuration
Edit your host configuration:This enables the Lanzaboote module which handles secure boot.
Rebuild without secure boot active
Apply the configuration while secure boot is still disabled:This installs the necessary packages (
sbctl) and configures Lanzaboote.Create and enroll secure boot keys
Generate and enroll your secure boot keys:The
--microsoft flag ensures Windows will still boot.Sign bootloader and kernel
Verify that your bootloader and kernel are signed:Lanzaboote should automatically sign the necessary files. If anything is unsigned:
Mount Windows EFI partition
To ensure the Windows bootloader is accessible from NixOS:Locate the Windows EFI partition
Find the EFI partition device:Look for a small partition (usually 100-500MB) with FSTYPE “vfat”.
Mount the Windows EFI partition
Create a temporary mount point:Replace
/dev/nvme0n1p1 with your actual EFI partition device.Copy Windows EFI files
Copy the Windows bootloader to your NixOS EFI partition:This ensures both bootloaders are available.
Verify dual boot
Test booting
Restart your computer:You should see a boot menu with options for:
- NixOS (current and previous generations)
- Windows Boot Manager
Boot manager configuration
Set default boot entry
To change the default OS that boots:Adjust boot timeout
Edit your NixOS configuration:Sharing files between systems
Access Windows files from NixOS
Mount the Windows partition:Access NixOS files from Windows
Windows can’t read ext4 natively. Options:- Use WSL - Install NixOS on WSL for file access (see WSL guide)
- Third-party tools - Tools like Linux File Systems for Windows
- Shared partition - Create a separate FAT32 or NTFS partition for shared files
Troubleshooting
Windows disappeared from boot menu
If Windows doesn’t appear in the boot menu:Secure boot violations
If you get secure boot violation errors:Time differences between systems
Windows and Linux handle hardware clock differently: Fix in Windows (recommended):Can’t boot either system
Boot from the NixOS installer USB and:Lanzaboote issues
For detailed troubleshooting, see the Lanzaboote quick start guide.Understanding the configuration
The secure boot configuration uses Lanzaboote frommodules/nixos/boot/secure-boot.nix:
- Installs
sbctlfor key management - Enables Lanzaboote to replace systemd-boot
- Stores secure boot keys in
/var/lib/sbctl
Next steps
NixOS installation
Complete NixOS installation guide
Configuration guide
Customize your NixOS setup