# Notes on installing NixOS on Dell XPS-13 Late 2016 9360
# Build a NixOS bootable USB stick via dd and NixOS image
# remember to umount otherwise will encounter
# Boot from the usb.
# F12 to enter boot menu
# Set dvorak keymap
loadkeys dvorak
# Root becomes Btrfs (not ext4)
parted /dev/nvme0n1 -- mkpart root btrfs 512MiB -34GiB
# Swap
parted /dev/nvme0n1 -- mkpart swap linux-swap -34GiB 100%
# ESP stays the same
parted /dev/nvme0n1 -- mkpart ESP fat32 1MiB 512MiB
parted /dev/nvme0n1 -- set 3 esp on
mkfs.fat -F32 /dev/nvme0n1p3 # ESP
mkfs.btrfs -L nixroot /dev/nvme0n1p1 # root
mkswap /dev/nvme0n1p2 # swap
# Mount once to make subvolumes
mount /dev/nvme0n1p1 /mnt
btrfs su cr /mnt/@ # root
btrfs su cr /mnt/@home
btrfs su cr /mnt/@nix # nix store
btrfs su cr /mnt/@log
# id of root subvolume
btrfs su list /mnt
btrfs subvolume set-default <id> /mnt
# Unmounting + remounting ensures that:
# the default subvolume you just set is active
# the filesystem now mounts into @ instead of the top-level subvolume
umount /mnt
mount -o compress=zstd,noatime,ssd,space_cache=v2,discard=async,subvol=@ /dev/nvme0n1p1 /mnt
mkdir -p /mnt/{home,nix,var/log}
mount -o compress=zstd,noatime,ssd,space_cache=v2,discard=async,subvol=@home /dev/nvme0n1p1 /mnt/home
mount -o compress=zstd,noatime,ssd,space_cache=v2,discard=async,subvol=@nix /dev/nvme0n1p1 /mnt/nix
mount -o compress=zstd,noatime,ssd,space_cache=v2,discard=async,subvol=@log /dev/nvme0n1p1 /mnt/var/log
mkdir -p /mnt/boot
mount -o umask=077 /dev/nvme0n1p3 /mnt/boot
swapon /dev/nvme0n1p2
# config
nixos-generate-config --root /mnt
# set console tty kb layout
# TODO: the configure.nix, reboot, and set the customize keymap
# TODO: install home-manager: https://nix-community.github.io/home-manager/index.xhtml#sec-install-standalone
# TODO: then it is neovim, should be the plane one, not using my nvim config. I'll do it using nixvim