nixos
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-04 08:51:57 +08:00
configuration.nix Update README 2026-09-04 08:51:39 +08:00
flake.lock Update/Switch 2026-08-21 20:39:55 +08:00
flake.nix Update README 2026-09-04 08:51:39 +08:00
hardware-configuration.nix Update/Switch 2026-08-20 18:27:06 +08:00
README.md Update README 2026-09-04 08:51:39 +08:00

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