1 import ./make-test-python.nix ({ pkgs, ... }: {
2 name = "nixos-rebuild-install-bootloader";
5 machine = { lib, pkgs, ... }: {
7 ../modules/profiles/installation-device.nix
8 ../modules/profiles/base.nix
12 substituters = lib.mkForce [ ];
13 hashed-mirrors = null;
17 system.includeBuildDependencies = true;
24 virtualisation.useBootLoader = true;
30 configFile = pkgs.writeText "configuration.nix" ''
33 ./hardware-configuration.nix
34 <nixpkgs/nixos/modules/testing/test-instrumentation.nix>
43 documentation.enable = false;
50 machine.succeed("udevadm settle")
51 machine.wait_for_unit("multi-user.target")
53 machine.succeed("nixos-generate-config")
54 machine.copy_from_host(
56 "/etc/nixos/configuration.nix",
58 machine.succeed("nixos-rebuild switch")
60 # Need to run `nixos-rebuild` twice because the first run will install
62 with subtest("Switch system again and install bootloader"):
63 result = machine.succeed("nixos-rebuild switch --install-bootloader 2>&1")
64 # install-grub2.pl messages
65 assert "updating GRUB 2 menu..." in result
66 assert "installing the GRUB 2 boot loader on /dev/vda..." in result
68 assert "Installation finished. No error reported." in result
69 # at this point we've tested regression #262724, but haven't tested the bootloader itself
70 # TODO: figure out how to how to tell the test driver to start the bootloader instead of
71 # booting into the kernel directly.