Expose ports from NixOS test VM to host machine

Hello peeps,

I wanted to know if there is a (documented) way to expose some ports from a NixOS VM test (when run using driverInteractive). I want to be able to navigate to localhost:<port> on my host’s browser to check that a new NixOS module I wrote is working correctly by interacting with the webui (so the curl localhost:<port> inside the test is not enough).

You can use the virtualisation.forwardPorts option

1 Like