From feeb365e31effdfef92a21176f88941fb2a7f126 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 16 Nov 2024 13:19:46 -0500 Subject: [PATCH 1/2] module: Expose tests.bootCommands Useful for e.g. interactive input during VM boot. --- module.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/module.nix b/module.nix index 3f444de..59da4c8 100644 --- a/module.nix +++ b/module.nix @@ -153,6 +153,14 @@ in }; tests = { + bootCommands = lib.mkOption { + description = '' + NixOS test script commands to run after the machine has started. Can + be used to enter an interactive password. + ''; + type = lib.types.lines; + }; + efi = lib.mkOption { description = '' Whether efi is enabled for the `system.build.installTest`. @@ -226,6 +234,7 @@ in name = "${config.networking.hostName}-disko"; disko-config = builtins.removeAttrs config [ "_module" ]; testMode = "direct"; + bootCommands = cfg.tests.bootCommands; efi = cfg.tests.efi; extraSystemConfig = cfg.tests.extraConfig; extraTestScript = cfg.tests.extraChecks; From c3b83db725d33e74d41324df6dc55d9098510483 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 16 Nov 2024 13:27:42 -0500 Subject: [PATCH 2/2] module: Expose tests.enableOCR Given we now have tests.bootCommands, in some cases the test script given will need OCR enabled. --- module.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/module.nix b/module.nix index 59da4c8..7231aef 100644 --- a/module.nix +++ b/module.nix @@ -171,6 +171,14 @@ in default = config.boot.loader.systemd-boot.enable || config.boot.loader.grub.efiSupport; }; + enableOCR = lib.mkOption { + description = '' + Sets the enableOCR option in the NixOS VM test driver. + ''; + type = lib.types.bool; + default = false; + }; + extraChecks = lib.mkOption { description = '' extra checks to run in the `system.build.installTest`. @@ -236,6 +244,7 @@ in testMode = "direct"; bootCommands = cfg.tests.bootCommands; efi = cfg.tests.efi; + enableOCR = cfg.tests.enableOCR; extraSystemConfig = cfg.tests.extraConfig; extraTestScript = cfg.tests.extraChecks; };