- https://nixos.org/nixos/manual/index.html#sec-installing-from-other-distro
- https://nixos.wiki/wiki/Install_NixOS_on_Online.Net
- https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks/en
- https://wiki.gentoo.org/wiki/Complete_Handbook/Software_RAID
add-apt-repository universe
apt-get update -qy
apt-get install -qy xfsprogs curl vim-nox mdadm # pacman -Syy xfsprogs curl vim mdadm
modprobe raid0 raid1 raid10 xfs f2fs
export LANG=POSIX
export LC_ALL=POSIX
# wipefs -a /dev/sda
# parted -a optimal /dev/sda
# mklabel gpt
# unit mib
# mkpart primary 1 3
# name 1 grub
# set 1 bios_grub on
# mkpart primary 3 1027
# name 2 boot
# mkpart primary 1027 -1
# name 3 rootfs
# sfdisk -d $source | sfdisk $dest
# mdadm --create /dev/md0 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda1 /dev/sdb1
mkfs.ext2 /dev/sda1
mkfs.xfs /dev/sda2 -L nixos
mount /dev/sda2 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
groupadd -g 30000 nixbld
useradd -u 30000 -g nixbld -G nixbld nixbld
curl https://nixos.org/nix/install | sh
. $HOME/.nix-profile/etc/profile.d/nix.sh
nix-env -iE "_: with import <nixpkgs/nixos> { configuration = {}; }; with config.system.build; [ nixos-generate-config nixos-install nixos-enter manual.manpages ]"
nixos-generate-config --root /mnt
unset NIXOS_CONFIG
nixos-install --root /mnt
chmod -R a-rx /mnt/etc/nixos
umount /mnt/boot /mnt