This section guides you through installing NixOS with Btrfs and EFI using my dotfiles. The instructions assume you’re starting from the NixOS minimal installer ISO and want a minimal, reproducible system.
Download the latest NixOS minimal ISO from https://nixos.org/download.html and boot it (USB/DVD).
Open a terminal and run:
cfdisk /dev/sdXCreate these partitions:
- EFI System Partition (512M, type EFI System)
- Linux Swap (size as needed, type Linux swap)
- Linux Filesystem (rest of disk, type Linux filesystem)
Suppose your layout is:
- /dev/sdX1 EFI
- /dev/sdX2 swap
- /dev/sdX3 root
mkfs.vfat -F 32 /dev/sdX1 # EFI partition
mkswap /dev/sdX2 # Swap
mkfs.btrfs -f /dev/sdX3 # Root (Btrfs)mount /dev/sdX3 /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
umount /mntmount -o subvol=@ /dev/sdX3 /mnt
mkdir /mnt/home
mount -o subvol=@home /dev/sdX3 /mnt/home
mkdir /mnt/boot
mount /dev/sdX1 /mnt/boot
swapon /dev/sdX2Optional (but recommended, this is what i did) To enable Btrfs compression (using zstd, which is a good default), simply add ,compress=zstd to your mount options when mounting your Btrfs partitions during installation. For example, use:
mount -o compress=zstd,subvol=@ /dev/sdX3 /mnt
mount -o compress=zstd,subvol=@home /dev/sdX3 /mnt/homeThis will turn on transparent compression for your files, helping save space with no extra steps needed.
nixos-generate-config --root /mntFor wired: usually works out of the box.
For Wi-Fi: use iwctl or nmtui to connect.
Make sure you have network access, then:
nix-shell -p git
git clone https://github.com/YOUR_GITHUB_USERNAME/.dotfiles /mnt/home/vaish/.dotfilesTip: It’s recommended to fork my repo and use your fork, so you can track your own changes.
It’s important to replace the hardware-configuration.nix in the dotfiles with the one generated for your hardware:
cp /mnt/etc/nixos/hardware-configuration.nix /mnt/home/vaish/.dotfiles/hardware-configuration.nixEdit /mnt/home/vaish/.dotfiles/configuration.nix and update any paths or usernames if you use something other than vaish.
Change into the dotfiles directory and install:
cd /mnt/home/vaish/.dotfiles
nixos-install --flake .#your-hostnameReplace your-hostname with whatever you set as your hostname in the configuration.
reboot- Hardware configuration is unique to your system.
- Forking lets you keep your changes (hardware, users, secrets) separate from mine.
- You can safely pull updates from upstream without affecting your customizations.