Personal configuration for NixOS, home-manager and others.
- Partition accordingly.
- Set up LUKS as appropriate.
cryptsetup luksFormat /dev/XXX
cryptsetup open /dev/XXX crypt
pvcreate /dev/mapper/crypt
vgcreate data /dev/mapper/crypt
lvcreate -n swap -L 4G data
lvcreate -n root -l 100%FREE data
mkswap /dev/mapper/data-swap
mkfs.btrfs /dev/mapper/data-root
- Create subvolumes.
mount -t btrfs /dev/mapper/data-root -o noatime,ssd,space_cache=v2,commit=120,compress=zstd /mnt
for i in root home nix persist log; do btrfs sub create /mnt/$i; done
btrfs sub snap -r /mnt/root{,-blank}
umount /mnt
mount -t btrfs /dev/mapper/data-root -o noatime,ssd,space_cache=v2,commit=120,compress=zstd,subvol=root /mnt
mkdir -p /mnt/{home,nix,persist,var/log,boot}
for i in home nix persist; do mount -t btrfs /dev/mapper/data-root -o noatime,ssd,space_cache=v2,commit=120,compress=zstd,subvol=$i /mnt/$i; done
mount -t btrfs /dev/mapper/data-root -o noatime,ssd,space_cache=v2,commit=120,compress=zstd,subvol=log /mnt/var/log
mount /dev/BOOTPARTITION /mnt/boot
nixos-generate-config --root /mnt
and copy relevant generated details to a new host undernixos/
.- Write host-specific config under new host under
nixos/
.- UUIDs can be found using
blkid | grep UUID
.
- UUIDs can be found using
- Setup password files.
mkdir -p /mnt/persist/passwd
mkpasswd -m sha-512 > /mnt/persist/passwd/root
mkpasswd -m sha-512 > /mnt/persist/passwd/user
nixos-install --impure --flake /path/to/conf.nix#NEWHOSTNAME
RIP kiwami, utility repo