at v192 2.9 kB view raw
1Let all the files in the system tarball sit in a directory served by NFS (the 2NFS root) like this in exportfs: 3 /home/pcroot 192.168.1.0/24(rw,no_root_squash,no_all_squash) 4 5Run "exportfs -a" after editing /etc/exportfs, for the nfs server to be aware 6of the changes. 7 8Use a tftp server serving the root of boot/ (from the system tarball). 9 10In order to have PXE boot, use the boot/dhcpd.conf-example file for your dhcpd 11server, as it will point your PXE clients to pxelinux.0 from the tftp server. 12Adapt the configuration to your network. 13 14Adapt the pxelinux configuration (boot/pxelinux.cfg/default) to set the path to 15your nfrroot. If you use ip=dhcp in the kernel, the nfs server ip will be taken 16from dhcp and so you don't have to specify it. 17 18The linux in bzImage includes network drivers for some usual cards. 19 20 21QEMU Testing 22--------------- 23 24You can test qemu pxe boot without having a DHCP server adapted, but having 25nfsroot, like this: 26 qemu-system-x86_64 -tftp /home/pcroot/boot -net nic -net user,bootfile=pxelinux.0 -boot n 27 28I don't know how to use NFS through the qemu '-net user' though. 29 30 31QEMU Testing with NFS root and bridged network 32------------------------------------------------- 33 34This allows testing with qemu as any other host in your LAN. 35 36Testing with the real dhcpd server requires setting up a bridge and having a 37tap device. 38 tunctl -t tap0 39 brctl addbr br0 40 brctl addif br0 eth0 41 brctl addif tap0 eth0 42 ifconfig eth0 0.0.0.0 up 43 ifconfig tap0 0.0.0.0 up 44 ifconfig br0 up # With your ip configuration 45 46Then you can run qemu: 47 qemu-system-x86_64 -boot n -net tap,ifname=tap0,script=no -net nic,model=e1000 48 49 50Using the system-tarball-pc in a chroot 51-------------------------------------------------- 52 53Installation: 54 mkdir nixos-chroot && cd nixos-chroot 55 tar xf your-system-tarball.tar.xz 56 mkdir sys dev proc tmp root var run 57 mount --bind /sys sys 58 mount --bind /dev dev 59 mount --bind /proc proc 60 61Activate the system: look for a directory in nix/store similar to: 62 "/nix/store/y0d1lcj9fppli0hl3x0m0ba5g1ndjv2j-nixos-feb97bx-53f008" 63Having found it, activate that nixos system *twice*: 64 chroot . /nix/store/SOMETHING-nixos-SOMETHING/activate 65 chroot . /nix/store/SOMETHING-nixos-SOMETHING/activate 66 67This runs a 'hostname' command. Restore your old hostname with: 68 hostname OLDHOSTNAME 69 70Copy your system resolv.conf to the /etc/resolv.conf inside the chroot: 71 cp /etc/resolv.conf etc 72 73Then you can get an interactive shell in the nixos chroot. '*' means 74to run inside the chroot interactive shell 75 chroot . /bin/sh 76* source /etc/profile 77 78Populate the nix database: that should be done in the init script if you 79had booted this nixos. Run: 80* `grep local-cmds run/current-system/init` 81 82Then you can proceed normally subscribing to a nixos channel: 83 nix-channel --add https://nixos.org/channels/nixos-unstable 84 nix-channel --update 85 86Testing: 87 nix-env -i hello 88 which hello 89 hello