about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorNahum Shalman <nshalman@omniti.com>2016-04-08 13:53:27 +0000
committerDomen Kožar <domen@dev.si>2016-04-29 10:42:39 +0100
commit83c0aca062369aa43d5e692f22ff22e8d2e787a1 (patch)
treef2a53e3e9e7ddab85f6688bed0eaa348352c59de /nixos/tests
parentecfc523d32b6969fbb0c5641fb2d155812e2b9f8 (diff)
downloadnixlib-83c0aca062369aa43d5e692f22ff22e8d2e787a1.tar
nixlib-83c0aca062369aa43d5e692f22ff22e8d2e787a1.tar.gz
nixlib-83c0aca062369aa43d5e692f22ff22e8d2e787a1.tar.bz2
nixlib-83c0aca062369aa43d5e692f22ff22e8d2e787a1.tar.lz
nixlib-83c0aca062369aa43d5e692f22ff22e8d2e787a1.tar.xz
nixlib-83c0aca062369aa43d5e692f22ff22e8d2e787a1.tar.zst
nixlib-83c0aca062369aa43d5e692f22ff22e8d2e787a1.zip
installer: simple PXE bootable NixOS installer
The Nix store squashfs is stored inside the initrd instead of separately

(cherry picked from commit 976fd407796877b538c470d3a5253ad3e1f7bc68)
Signed-off-by: Domen Kožar <domen@dev.si>
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/boot.nix40
1 files changed, 38 insertions, 2 deletions
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