diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2022-09-28 17:15:11 +0200 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2022-09-28 17:15:11 +0200 |
commit | 7da8d25d8727b0f54f4918196b1ba13d946486b6 (patch) | |
tree | 7adcef207df68aa7483af231bd1c9e4367472a71 /nixos/lib/testing/interactive.nix | |
parent | 7ddee326c2b49e0da7d96801fa703fe884455871 (diff) | |
parent | 530b2323c94597d1f7efe2c8ceaf46ec2e026e9b (diff) | |
download | nixpkgs-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.nix | 45 |
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; + }; +} |