DISK=/dev/null # Create two partitions here: p1 and p2 fdisk $DISK # Formats the partitions mkfs.vfat -n BOOT ${DISK}p1 mkfs.btrfs -L ROOT ${DISK}p2 mount -t btrfs ${DISK}p2 # Creates btrfs subvolumes btrfs subvolume create /mnt/root btrfs subvolume create /mnt/home btrfs subvolume create /mnt/nix btrfs subvolume create /mnt/persist btrfs subvolume create /mnt/log # Creates snapshot btrfs subvolume snapshot -r /mnt/root /mnt/root-blank umount /mnt # Creates the directories for the subvolumes to be mounted to, nixos-install will detect this. mount -o subvol=root,compress=zstd,noatime ${DISK}p2 /mnt mkdir /mnt/home mount -o subvol=home,compress=zstd,noatime ${DISK}p2 /mnt/home mkdir /mnt/nix mount -o subvol=nix,compress=zstd,noatime ${DISK}p2 /mnt/nix mkdir /mnt/persist mount -o subvol=persist,compress=zstd,noatime ${DISK}p2 /mnt/persist mkdir -p /mnt/var/log mount -o subvol=log,compress=zstd,noatime ${DISK}p2 /mnt/var/log mkdir /mnt/boot mount "$DISK"p1 /mnt/boot nixos-generate-config --root /mnt # Add `"compress=zstd" "noatime"` to all btrfs fileSystem entries # Add `neededForBoot = true;` to the logging subvolume nano /mnt/etc/nixos/hardware-configuration.nix echo "Initial setup complete :D" nixos-install reboot