How to run a nixos test interactively?

I try to run a nixos test interactively as described here: Integration testing using virtual machines (VMs) — documentation
the example command is:
$(nix-build -A driver postgrest.nix)/bin/nixos-test-driver
The problem is that it actually runs the test script and does not start a python repl as described in the document.

because the example on is broken i use this simple test:

  nixpkgs = <nixpkgs>;
  pkgs = import nixpkgs {};
  pkgs.nixosTest {
    nodes.machine = { config, pkgs, ...}: {
      boot.loader.systemd-boot.enable = true;
      boot.loader.efi.canTouchEfiVariables = true;

      services.xserver.enable = true;
      services.xserver.displayManager.gdm.enable = true;
      services.xserver.desktopManager.gnome.enable = true;

      users.users.jane = {
        isNormalUser = true;
        extraGroups = ["wheel"]; # Enable ‘sudo’ for the user.
        packages = with pkgs; [

      system.stateVersion = "22.05";

    testScript = {nodes, ...}: ''
      machine.succeed("su -- jane -c 'which firefox'")"su -- root -c 'which firefox'")
1 Like

The driver attribute should be driverInteractive. Or you can pass --interactive flag to the nixos-test-driver program.

1 Like

@olaf would be great if you could add at least the correct command line. I actually like your simple example a lot. Could you use that as an introduction and than add a paragraph to transition to a more complex setup?

I work on a more complete revision of the topic need a few more days to show the first half of it.