see here:
The VM does not have any data from your host system, so your existing user accounts and home directories will not be available unless you have set mutableUsers = false . Another way is to temporarily add the following to your configuration:
users.users.your-user.initialHashedPassword = “test”;
Important: delete the $hostname.qcow2 file if you have started the virtual machine at least once without the right users, otherwise the changes will not get picked up. You can forward ports on the host to the guest. For instance, the following will forward host port 2222 to guest port 22 (SSH):
$
QEMU_NET_OPTS=“hostfwd=tcp::2222-:22” ./result/bin/run-*-vm
allowing you to log in via SSH (assuming you have set the appropriate passwords or SSH authorized keys):
$
ssh -p 2222 localhost