I try to run a nixos test interactively as described here: Integration testing using virtual machines (VMs) — nix.dev 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 nix.dev is broken i use this simple test:
let
nixpkgs = <nixpkgs>;
pkgs = import nixpkgs {};
in
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; [
firefox
thunderbird
];
};
system.stateVersion = "22.05";
};
testScript = {nodes, ...}: ''
machine.wait_for_unit("default.target")
machine.succeed("su -- jane -c 'which firefox'")
machine.fail("su -- root -c 'which firefox'")
'';
}