I’m improving the test wiring with the module system:
https://github.com/NixOS/nixpkgs/pull/176557
To add your own configuration to an existing test, you can use the new extend function for tests. defaults and nodes work just like in NixOps.
nixosTests.foo.extend {
# set any test-level options here, such as `enableOCR`, `meta`, ...
defaults = { config, lib, ... }: {
# set any NixOS-level options here, applied to all VMs
};
nodes.foo = {
# set any NixOS-level options here, applied to the `foo` machine only
# (created if necessary)
};
}
If nixosTests.foo consists of multiple test cases and/or a test matrix, i.e. multiple derivations, it works exactly the same, requiring no mapAttrs or anything like that.