nixos
- Nix 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| configuration.nix | ||
| flake.lock | ||
| flake.nix | ||
| hardware-configuration.nix | ||
| README.md | ||
Tsuki's Config
Assumption: You're root and you've copied to repo to /root/nixos/
1. Partition the disk
Using parted to create a GPT table with two partitions: a ~1GiB EFI System
Partition, and the remainder as the btrfs partition.
parted /dev/nvme0n1 -- mklabel gpt
parted /dev/nvme0n1 -- mkpart ESP fat32 1MiB 1025MiB
parted /dev/nvme0n1 -- set 1 esp on
parted /dev/nvme0n1 -- mkpart primary btrfs 1025MiB 100%
Result:
/dev/nvme0n1p1— EFI System Partition (~1023MiB)/dev/nvme0n1p2— btrfs (remainder, ~237.5GiB)
Confirm the layout:
parted /dev/nvme0n1 -- print
2. Format the partitions
mkfs.fat -F32 -n BOOT /dev/nvme0n1p1
mkfs.btrfs -L nixos /dev/nvme0n1p2
3. Create btrfs subvolumes
Mount the raw btrfs partition temporarily at /mnt to create subvolumes at the
top level:
mount /dev/nvme0n1p2 /mnt
Create the subvolumes:
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@nix
btrfs subvolume create /mnt/@log
btrfs subvolume create /mnt/@swap
Unmount before remounting with the actual subvolume layout:
umount /mnt
4. Mount subvolumes with proper options
mount -o compress=zstd,noatime,subvol=@ /dev/nvme0n1p2 /mnt
mkdir -p /mnt/{boot,home,nix,var/log,swap}
mount -o compress=zstd,noatime,subvol=@home /dev/nvme0n1p2 /mnt/home
mount -o compress=zstd,noatime,subvol=@nix /dev/nvme0n1p2 /mnt/nix
mount -o compress=zstd,noatime,subvol=@log /dev/nvme0n1p2 /mnt/var/log
mount -o noatime,subvol=@swap /dev/nvme0n1p2 /mnt/swap
mount /dev/nvme0n1p1 /mnt/boot
5. Generate the NixOS configuration
rm nixos/hardware-configuration.nix & cp nixos/* /mnt/etc/nixos/
nixos-generate-config --root /mnt