1 { config, hostPkgs, lib, ... }:
3 inherit (lib) types mkOption;
8 type = types.lazyAttrsOf types.raw;
10 Attributes to add to the returned derivations,
11 which are not necessarily part of the build.
13 This is a bit like doing `drv // { myAttr = true; }` (which would be lost by `overrideAttrs`).
14 It does not change the actual derivation, but adds the attribute nonetheless, so that
15 consumers of what would be `drv` have more information.
19 rawTestDerivation = mkOption {
22 Unfiltered version of `test`, for troubleshooting the test framework and `testBuildFailure` in the test framework's test suite.
23 This is not intended for general use. Use `test` instead.
30 # TODO: can the interactive driver be configured to access the network?
32 Derivation that runs the test as its "build" process.
34 This implies that NixOS tests run isolated from the network, making them
41 rawTestDerivation = hostPkgs.stdenv.mkDerivation {
42 name = "vm-test-run-${config.name}";
44 requiredSystemFeatures = [ "nixos-test" ]
45 ++ lib.optionals hostPkgs.stdenv.hostPlatform.isLinux [ "kvm" ]
46 ++ lib.optionals hostPkgs.stdenv.hostPlatform.isDarwin [ "apple-virt" ];
51 # effectively mute the XMLLogger
52 export LOGFILE=/dev/null
54 ${config.driver}/bin/nixos-test-driver -o $out
57 passthru = config.passthru;
61 test = lib.lazyDerivation { # lazyDerivation improves performance when only passthru items and/or meta are used.
62 derivation = config.rawTestDerivation;
63 inherit (config) passthru meta;
66 # useful for inspection (debugging / exploration)
67 passthru.config = config;