Bash shell for nixos test machine

Is it possible to get a bash prompt for a machine defined in a nixos test?
I am aware that you can run:

$ nix-build -A driver ./test.nix
$ ./result/bin/nixos-test-driver
> startAll
> $machine->succeed("echo hey")

But the perl wrapping of bash commands gets annoying very vast.

Also in it states:

The script nixos-run-vms starts the virtual machines defined by test.

That’s not very clear and --help doesn’t work on it.
What is it supposed to do?

Help yourself, have you tried to run it? it’s pretty self explanatory. :wink:

Inside the NixOS tests the machines are accessible through perl variables and DNS records.
nixos-run-vms just starts the machines but doesn’t give me a prompt or something to interact with them. so what is it good for? are the machines exposed somewhere?

If you are running nixos-run-vms from an X11 terminal it should open one window per VM showing the console, where a normal login prompt should appear. I never tried it from a non-graphical terminal, I suppose there is some option to add some kind of redirection to the VMs I/O, but I don’t know the details.

1 Like

Yes, I guess that’s the issue.
I’m running everything on a linux server over ssh cause my local machine is a mac and tests are not supported on darwin.

Since you posted this I’ve discovered that if you set and export an environment variable named QEMU_OPTS, its value will be added to the Qemu command line, but I haven’t yet figured out how to connect to the test machine, have you?

Better, use something linke QEMU_NET_OPTS="hostfwd=tcp::10022-:22"

Previous to there was a way to hack into test machine. Unfortunately, it was reverted due to some conflicts with Hydra CI…

You may try to revert that revert and try to socat into machine.