Skip to content

Instantly share code, notes, and snippets.

@bmpvieira
Last active February 19, 2019 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmpvieira/997bc87022ebc97c6df507411c87546a to your computer and use it in GitHub Desktop.
Save bmpvieira/997bc87022ebc97c6df507411c87546a to your computer and use it in GitHub Desktop.
Nix install
From Ubuntu Live USB
sudo apt update
sudo apt install -y git curl zfsutils-linux
bash <(curl https://nixos.org/nix/install)
. $HOME/.nix-profile/etc/profile.d/nix.sh # …or open a fresh shell
nix-channel --add https://nixos.org/channels/nixos-unstable nixpkgs
nix-channel --update
nix-env -iE "_: with import <nixpkgs/nixos> { configuration = {}; }; with config.system.build; [ nixos-generate-config nixos-install nixos-enter manual.manpages ]"
DISK=/dev/disk/by-id/nvme-INTEL_SSDPED1D480GA_PHMB745400PH480DGN
#sudo sgdisk -Z $DISK
sudo sgdisk -a1 -n2:34:2047 -t2:EF02 $DISK
sudo sgdisk -n3:1M:+512M -t3:EF00 $DISK
sudo sgdisk -n1:0:0 -t1:BF01 $DISK
#sudo zpool create -O atime=off -O relatime=off -O compression=lz4 -O normalization=formD -O xattr=sa rpool $DISK-part1
sudo zpool create -O mountpoint=none -R /mnt rpool $DISK-part1 -f
sudo zfs set reservation=1G rpool
sudo zfs create -o mountpoint=none rpool/root
sudo zfs create -o mountpoint=legacy rpool/root/nixos
sudo zfs create -o mountpoint=legacy rpool/home
sudo mount -t zfs rpool/root/nixos /mnt
sudo mkdir /mnt/home
sudo mount -t zfs rpool/home /mnt/home
sudo mkfs.vfat -i 1337d15c $DISK-part3
sudo mkdir /mnt/boot
sudo mount $DISK-part3 /mnt/boot
sudo `which nixos-generate-config` --root /mnt
# rsync -avP nixconfig ubuntu@192.168.1.138:
# head -c4 /dev/urandom | od -A none -t x4 # something like c7617374, put in config networking.hostId
sudo cp -r /home/ubuntu/nixconfig /mnt/etc/
sudo mv /mnt/etc/nixos /home/ubuntu/
cd /mnt/etc
sudo ln -s nixconfig/bigowls/ornimegalonyx nixos
# sudo nano /mnt/etc/nixos/hardware-configuration.nix
# sudo nano /mnt/etc/nixos/configuration.nix
sudo adduser --disabled-password --gecos "" builder
sudo addgroup nixbld
sudo usermod -G nixbld builder
sudo PATH="$PATH" NIX_PATH="$NIX_PATH" `which nixos-install` --root /mnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment