NixOS VM tests: Difference between revisions
imported>Olafklingt move haskellforall example from nix.dev here |
Add section on connecting to an interactive VM via SSH |
||
| Line 14: | Line 14: | ||
In interactive mode, you can run `start_all` followed by `join_all` to start and keep the VM alive | In interactive mode, you can run `start_all` followed by `join_all` to start and keep the VM alive | ||
== Connecting to an interactive VM via SSH == | |||
Add this to your test config: | |||
interactive.nodes.machine = { | |||
services.openssh = { | |||
enable = true; | |||
settings = { | |||
PermitRootLogin = "yes"; | |||
PermitEmptyPasswords = "yes"; | |||
}; | |||
}; | |||
security.pam.services.sshd.allowNullPassword = true; | |||
virtualisation.forwardPorts = [ | |||
{ from = "host"; host.port = 2000; guest.port = 22; } | |||
]; | |||
}; | |||
Now you can connect to this VM via | |||
ssh root@localhost -p 2200 | |||
== How to debug tests ? == | == How to debug tests ? == | ||