Scripts and tools for building and running NixOS VMs using Hyperkit on macOS.
- Download a minimal installation CD from the NixOS download
page saving it in the
isos
directory.
# https://d3g5gsiof5omrk.cloudfront.net/nixos/18.03/nixos-18.03.132687.14c248a4ab7/nixos-minimal-18.03.132687.14c248a4ab7-x86_64-linux.iso
mkdir isos/nixos-minimal-18.03.132687.14c248a4ab7-x86_64-linux.iso
curl -Lo nixos-minimal-18.03.132687.14c248a4ab7-x86_64-linux.iso/raw.iso https://d3g5gsiof5omrk.cloudfront.net/nixos/18.03/nixos-18.03.132687.14c248a4ab7/nixos-minimal-18.03.132687.14c248a4ab7-x86_64-linux.iso
- Start a VM using the downloaded installation CD.
make livecd ISO=isos/nixos-minimal-18.03.132687.14c248a4ab7-x86_64-linux.iso
- In the VM, start the SSH dameon and set a root password.
systemctl start sshd
passwd
- Find the IP address of the VM and copy
iso.nix
to the VM.
bin/scp iso.nix [email protected]:iso.nix
- Remount the tmpfs used by the Nix store with more space to ensure the ISO can build.
mount -o remount,size=2G /nix/.rw-store
- Build the ISO.
nix-build '<nixpkgs/nixos>' -A config.system.build.isoImage -I nixos-config=iso.nix
- Copy the ISO from the VM to the
isos
directory.
mkdir isos/nixos-custom-18.03.132628.a381b789984-x86_64-linux.iso
bin/scp [email protected]:result/iso/nixos-custom-18.03.132628.a381b789984-x86_64-linux.iso \
isos/nixos-custom-18.03.132628.a381b789984-x86_64-linux.iso/raw.iso