From 83c0aca062369aa43d5e692f22ff22e8d2e787a1 Mon Sep 17 00:00:00 2001 From: Nahum Shalman Date: Fri, 8 Apr 2016 13:53:27 +0000 Subject: installer: simple PXE bootable NixOS installer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Nix store squashfs is stored inside the initrd instead of separately (cherry picked from commit 976fd407796877b538c470d3a5253ad3e1f7bc68) Signed-off-by: Domen Kožar --- nixos/tests/boot.nix | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'nixos/tests') diff --git a/nixos/tests/boot.nix b/nixos/tests/boot.nix index 905d16458825..a138ba4bcf08 100644 --- a/nixos/tests/boot.nix +++ b/nixos/tests/boot.nix @@ -44,5 +44,41 @@ in { usb => glob("${iso}/iso/*.iso"), bios => '${pkgs.OVMF}/FV/OVMF.fd' ''; - } - + netboot = let + config = (import ../lib/eval-config.nix { + inherit system; + modules = + [ ../modules/installer/netboot/netboot.nix + ../modules/testing/test-instrumentation.nix + { key = "serial"; } + ]; + }).config; + ipxeScriptDir = pkgs.writeTextFile { + name = "ipxeScriptDir"; + text = '' + #!ipxe + dhcp + kernel bzImage init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} console=ttyS0 + initrd initrd + boot + ''; + destination = "/boot.ipxe"; + }; + ipxeBootDir = pkgs.symlinkJoin "ipxeBootDir" [ + config.system.build.netbootRamdisk + config.system.build.kernel + ipxeScriptDir + ]; + in + makeTest { + name = "boot-netboot"; + nodes = { }; + testScript = + '' + my $machine = createMachine({ qemuFlags => '-boot order=n -net nic,model=e1000 -net user,tftp=${ipxeBootDir}/,bootfile=boot.ipxe -m 2000M' }); + $machine->start; + $machine->waitForUnit("multi-user.target"); + $machine->shutdown; + ''; + }; +} \ No newline at end of file -- cgit 1.4.1