mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 20:25:32 +03:00

Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
65 lines
1.8 KiB
Nix
65 lines
1.8 KiB
Nix
import ./make-test-python.nix (
|
|
{ lib, ... }:
|
|
{
|
|
name = "grub";
|
|
|
|
meta = with lib.maintainers; {
|
|
maintainers = [ rnhmjoj ];
|
|
};
|
|
|
|
nodes.machine =
|
|
{ ... }:
|
|
{
|
|
virtualisation.useBootLoader = true;
|
|
|
|
boot.loader.timeout = null;
|
|
boot.loader.grub = {
|
|
enable = true;
|
|
users.alice.password = "supersecret";
|
|
|
|
# OCR is not accurate enough
|
|
extraConfig = "serial; terminal_output serial";
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
def grub_login_as(user, password):
|
|
"""
|
|
Enters user and password to log into GRUB
|
|
"""
|
|
machine.wait_for_console_text("Enter username:")
|
|
machine.send_chars(user + "\n")
|
|
machine.wait_for_console_text("Enter password:")
|
|
machine.send_chars(password + "\n")
|
|
|
|
|
|
def grub_select_all_configurations():
|
|
"""
|
|
Selects "All configurations" from the GRUB menu
|
|
to trigger a login request.
|
|
"""
|
|
machine.send_monitor_command("sendkey down")
|
|
machine.send_monitor_command("sendkey ret")
|
|
|
|
|
|
machine.start()
|
|
|
|
# wait for grub screen
|
|
machine.wait_for_console_text("GNU GRUB")
|
|
|
|
grub_select_all_configurations()
|
|
with subtest("Invalid credentials are rejected"):
|
|
grub_login_as("wronguser", "wrongsecret")
|
|
machine.wait_for_console_text("error: access denied.")
|
|
|
|
grub_select_all_configurations()
|
|
with subtest("Valid credentials are accepted"):
|
|
grub_login_as("alice", "supersecret")
|
|
machine.send_chars("\n") # press enter to boot
|
|
machine.wait_for_console_text("Linux version")
|
|
|
|
with subtest("Machine boots correctly"):
|
|
machine.wait_for_unit("multi-user.target")
|
|
'';
|
|
}
|
|
)
|