Installation
NixOS can be installed on bare metal, in a VM, on macOS (via nix-darwin), and even inside Windows (via WSL). This guide covers all major scenarios with examples and configuration tips.
1. Install NixOS on a PC (Bare Metal or VM)
Download and Boot
Download the latest ISO: https://nixos.org/download.html
Write to USB:
sudo dd if=nixos-*.iso of=/dev/sdX bs=4M status=progress
Boot from USB and select "Install NixOS."
Partition, Format, and Mount
Example (UEFI, single disk):
Generate and Edit Configuration
Example minimal config:
Install and Reboot
2. Install NixOS in a VM
Use any hypervisor (VirtualBox, VMware, QEMU, Parallels, etc.).
Attach the ISO, follow the same steps as above.
For QEMU (Linux):
3. Nix on macOS (nix-darwin)
Install Nix Package Manager
Install nix-darwin
Example ~/.nixpkgs/darwin-configuration.nix
~/.nixpkgs/darwin-configuration.nix
Apply config:
4. NixOS on WSL (Windows Subsystem for Linux)
Install NixOS-WSL
Prerequisite: WSL2 enabled, Ubuntu or other WSL Linux installed.
Install NixOS-WSL:
Configure NixOS-WSL
Edit /etc/nixos/configuration.nix
as usual. Example:
Apply changes:
References
NixOS can be run and managed on nearly any platform, with full reproducibility and declarative configuration.
Last updated