Skip to content

Instantly share code, notes, and snippets.

@hbokh
Last active July 28, 2018 10:41
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 hbokh/e7ff246ba0b519fb9c1d46e782015ccb to your computer and use it in GitHub Desktop.
Save hbokh/e7ff246ba0b519fb9c1d46e782015ccb to your computer and use it in GitHub Desktop.
Install NixOS using PXE (not iPXE!)

NiXOS install through PXE

Based on: https://lastlog.de/blog/posts/nixos_pxe_booting.html

Get NixOS minimal ISO-image:

wget https://d3g5gsiof5omrk.cloudfront.net/nixos/18.03/nixos-18.03.132847.aec217852f2/nixos-minimal-18.03.132847.aec217852f2-x86_64-linux.iso

Loop-mount the image under /mnt/cdrom

cd /usr/local/buildserver/
mkdir tmp
cd tmp

zcat /mnt/cdrom/boot/initrd | cpio -i

mkdir mnt
mksquashfs /mnt/cdrom/nix-store.squashfs mnt/nix.squashfs

find . | cpio --create --format='newc' > /usr/local/tftproot/nixos/18.03.132847/initrd+squash_mnt-root_iso.gz

File tftproot/pxelinux.cfg/default

LABEL NixOS
    KERNEL nixos/18.03.132847/bzImage
    APPEND init=/nix/store/cixfdn6y7hy2kajbgk1fwy2xvwi8wgcb-nixos-system-nixos-18.03.132847.aec217852f2/init root=/mnt/nix.squashfs boot.shell_on_fail nomodeset loglevel=7 initrd=nixos/18.03.132847/initrd+squash_mnt-root_iso.gz
ls -al ../tftproot/nixos/18.03.132847/
total 434920
-rw-r----- 1 nobody nobody   4093488 Jul 28 10:26 bzImage
drwxr-xr-x 3 nobody nobody       512 Jul 28 10:42 ../
-rw-r----- 1 root   nobody 441047552 Jul 28 11:44 initrd+squash_mnt-root_iso.gz
drwxr-xr-x 2 nobody nobody       512 Jul 28 12:18 ./
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment