Skip to content

Instantly share code, notes, and snippets.

@timothyklim
Last active December 6, 2019 07:31
Show Gist options
  • Save timothyklim/9c1ffb63100a5b5dc092deba64e51974 to your computer and use it in GitHub Desktop.
Save timothyklim/9c1ffb63100a5b5dc092deba64e51974 to your computer and use it in GitHub Desktop.

Install NixOS from rescue/live cd

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment