summary refs log tree commit diff
path: root/nixos/lib/testing/interactive.nix
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2022-09-28 17:15:11 +0200
committerMartin Weinelt <hexa@darmstadt.ccc.de>2022-09-28 17:15:11 +0200
commit7da8d25d8727b0f54f4918196b1ba13d946486b6 (patch)
tree7adcef207df68aa7483af231bd1c9e4367472a71 /nixos/lib/testing/interactive.nix
parent7ddee326c2b49e0da7d96801fa703fe884455871 (diff)
parent530b2323c94597d1f7efe2c8ceaf46ec2e026e9b (diff)
downloadnixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar
nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar.gz
nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar.bz2
nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar.lz
nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar.xz
nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.tar.zst
nixpkgs-7da8d25d8727b0f54f4918196b1ba13d946486b6.zip
Merge remote-tracking branch 'origin/master' into staging-next
Diffstat (limited to 'nixos/lib/testing/interactive.nix')
-rw-r--r--nixos/lib/testing/interactive.nix45
1 files changed, 45 insertions, 0 deletions
diff --git a/nixos/lib/testing/interactive.nix b/nixos/lib/testing/interactive.nix
new file mode 100644
index 00000000000..317ed424188
--- /dev/null
+++ b/nixos/lib/testing/interactive.nix
@@ -0,0 +1,45 @@
+{ config, lib, moduleType, hostPkgs, ... }:
+let
+  inherit (lib) mkOption types mdDoc;
+in
+{
+  options = {
+    interactive = mkOption {
+      description = mdDoc ''
+        Tests [can be run interactively](#sec-running-nixos-tests-interactively)
+        using the program in the test derivation's `.driverInteractive` attribute.
+
+        When they are, the configuration will include anything set in this submodule.
+
+        You can set any top-level test option here.
+
+        Example test module:
+
+        ```nix
+        { config, lib, ... }: {
+
+          nodes.rabbitmq = {
+            services.rabbitmq.enable = true;
+          };
+
+          # When running interactively ...
+          interactive.nodes.rabbitmq = {
+            # ... enable the web ui.
+            services.rabbitmq.managementPlugin.enable = true;
+          };
+        }
+        ```
+
+        For details, see the section about [running tests interactively](#sec-running-nixos-tests-interactively).
+      '';
+      type = moduleType;
+      visible = "shallow";
+    };
+  };
+
+  config = {
+    interactive.qemu.package = hostPkgs.qemu;
+    interactive.extraDriverArgs = [ "--interactive" ];
+    passthru.driverInteractive = config.interactive.driver;
+  };
+}