···519520- `services.gitea` now supports CAPTCHA usage through the `services.gitea.captcha` variable.
521522-- The GRUB bootloader (`boot.loader.grub`) now generates [boot loader entries](https://uapi-group.org/specifications/specs/boot_loader_specification/).
523- These files are used by userspace tools (for example, `bootctl`) to inspect the bootloader status, getting the default boot entry, the path of the kernel binary, etc.
524- As a consequence, `systemctl kexec` now works automatically: specifying the kernel and its arguments with `kexec --load` is no longer required.
525-526- `bind.cacheNetworks` now only controls access for recursive queries, where it previously controlled access for all queries.
527528- [`services.mongodb.enableAuth`](#opt-services.mongodb.enableAuth) now uses the newer [mongosh](https://github.com/mongodb-js/mongosh) shell instead of the legacy shell to configure the initial superuser. You can configure the mongosh package to use through the [`services.mongodb.mongoshPackage`](#opt-services.mongodb.mongoshPackage) option.
···519520- `services.gitea` now supports CAPTCHA usage through the `services.gitea.captcha` variable.
5210000522- `bind.cacheNetworks` now only controls access for recursive queries, where it previously controlled access for all queries.
523524- [`services.mongodb.enableAuth`](#opt-services.mongodb.enableAuth) now uses the newer [mongosh](https://github.com/mongodb-js/mongosh) shell instead of the legacy shell to configure the initial superuser. You can configure the mongosh package to use through the [`services.mongodb.mongoshPackage`](#opt-services.mongodb.mongoshPackage) option.
-14
nixos/modules/system/boot/loader/grub/grub.nix
···50 then realGrub.override { efiSupport = cfg.efiSupport; }
51 else null;
5253- bootPath = if cfg.mirroredBoots != [ ]
54- then (builtins.head cfg.mirroredBoots).path
55- else "/boot";
56-57 f = x: optionalString (x != null) ("" + x);
5859 grubConfig = args:
···759 system.boot.loader.id = "grub";
760761 environment.systemPackages = mkIf (grub != null) [ grub ];
762-763- # Link /boot under /run/boot-loder-entries to make
764- # systemd happy even on non-EFI system
765- systemd.mounts = lib.optional (!cfg.efiSupport) {
766- what = bootPath;
767- where = "/run/boot-loader-entries";
768- type = "none";
769- options = "bind";
770- requiredBy = [ "local-fs.target" ];
771- };
772773 boot.loader.grub.extraPrepareConfig =
774 concatStrings (mapAttrsToList (n: v: ''
···1-{ pkgs, runTest }:
2-3-{
4- # Basic GRUB setup with BIOS and a password
5- basic = runTest {
6- name = "grub-basic";
7- meta.maintainers = with pkgs.lib.maintainers; [ rnhmjoj ];
8-9- nodes.machine = { ... }: {
10- virtualisation.useBootLoader = true;
11- boot.loader.timeout = null;
12- boot.loader.grub = {
13- enable = true;
14- users.alice.password = "supersecret";
15- # OCR is not accurate enough
16- extraConfig = "serial; terminal_output serial";
17- };
18- };
19-20- testScript = ''
21- def grub_login_as(user, password):
22- """
23- Enters user and password to log into GRUB
24- """
25- machine.wait_for_console_text("Enter username:")
26- machine.send_chars(user + "\n")
27- machine.wait_for_console_text("Enter password:")
28- machine.send_chars(password + "\n")
29-30-31- def grub_select_all_configurations():
32- """
33- Selects "All configurations" from the GRUB menu
34- to trigger a login request.
35- """
36- machine.send_monitor_command("sendkey down")
37- machine.send_monitor_command("sendkey ret")
38-39-40- machine.start()
4142- # wait for grub screen
43- machine.wait_for_console_text("GNU GRUB")
04445- grub_select_all_configurations()
46- with subtest("Invalid credentials are rejected"):
47- grub_login_as("wronguser", "wrongsecret")
48- machine.wait_for_console_text("error: access denied.")
4950- grub_select_all_configurations()
51- with subtest("Valid credentials are accepted"):
52- grub_login_as("alice", "supersecret")
53- machine.send_chars("\n") # press enter to boot
54- machine.wait_for_console_text("Linux version")
5556- with subtest("Machine boots correctly"):
57- machine.wait_for_unit("multi-user.target")
58- '';
59 };
06061- # Test boot loader entries on EFI
62- bls-efi = runTest {
63- name = "grub-bls-efi";
64- meta.maintainers = with pkgs.lib.maintainers; [ rnhmjoj ];
000006566- nodes.machine = { pkgs, ... }: {
67- virtualisation.useBootLoader = true;
68- virtualisation.useEFIBoot = true;
69- boot.loader.efi.canTouchEfiVariables = true;
70- boot.loader.grub.enable = true;
71- boot.loader.grub.efiSupport = true;
72- };
7374- testScript = ''
75- with subtest("Machine boots correctly"):
76- machine.wait_for_unit("multi-user.target")
00007778- with subtest("Boot entries are installed"):
79- entries = machine.succeed("bootctl list")
80- print(entries)
81- error = "NixOS boot entry not found in bootctl list."
82- assert "version: Generation 1" in entries, error
8384- with subtest("systemctl kexec can detect the kernel"):
85- machine.succeed("systemctl kexec --dry-run")
8687- with subtest("systemctl kexec really works"):
88- machine.execute("systemctl kexec", check_return=False)
89- machine.connected = False
90- machine.connect()
91- machine.wait_for_unit("multi-user.target")
92- '';
93- };
9495- # Test boot loader entries on BIOS
96- bls-bios = runTest {
97- name = "grub-bls-bios";
98- meta.maintainers = with pkgs.lib.maintainers; [ rnhmjoj ];
99-100- nodes.machine = { pkgs, ... }: {
101- virtualisation.useBootLoader = true;
102- boot.loader.grub.enable = true;
103- };
104-105- testScript = ''
106- with subtest("Machine boots correctly"):
107- machine.wait_for_unit("multi-user.target")
108-109- with subtest("Boot entries are installed"):
110- machine.succeed("test -f /boot/loader/entries/nixos-generation-1.conf")
111-112- with subtest("systemctl kexec can detect the kernel"):
113- machine.succeed("systemctl kexec --dry-run")
114115- with subtest("systemctl kexec really works"):
116- machine.execute("systemctl kexec", check_return=False)
117- machine.connected = False
118- machine.connect()
119- machine.wait_for_unit("multi-user.target")
120- '';
121- };
122123-}
000
···1+import ./make-test-python.nix ({ lib, ... }: {
2+ name = "grub";
0000000000000000000000000000000000000034+ meta = with lib.maintainers; {
5+ maintainers = [ rnhmjoj ];
6+ };
78+ nodes.machine = { ... }: {
9+ virtualisation.useBootLoader = true;
001011+ boot.loader.timeout = null;
12+ boot.loader.grub = {
13+ enable = true;
14+ users.alice.password = "supersecret";
01516+ # OCR is not accurate enough
17+ extraConfig = "serial; terminal_output serial";
018 };
19+ };
2021+ testScript = ''
22+ def grub_login_as(user, password):
23+ """
24+ Enters user and password to log into GRUB
25+ """
26+ machine.wait_for_console_text("Enter username:")
27+ machine.send_chars(user + "\n")
28+ machine.wait_for_console_text("Enter password:")
29+ machine.send_chars(password + "\n")
3000000003132+ def grub_select_all_configurations():
33+ """
34+ Selects "All configurations" from the GRUB menu
35+ to trigger a login request.
36+ """
37+ machine.send_monitor_command("sendkey down")
38+ machine.send_monitor_command("sendkey ret")
39000004041+ machine.start()
04243+ # wait for grub screen
44+ machine.wait_for_console_text("GNU GRUB")
000004546+ grub_select_all_configurations()
47+ with subtest("Invalid credentials are rejected"):
48+ grub_login_as("wronguser", "wrongsecret")
49+ machine.wait_for_console_text("error: access denied.")
0000000000000005051+ grub_select_all_configurations()
52+ with subtest("Valid credentials are accepted"):
53+ grub_login_as("alice", "supersecret")
54+ machine.send_chars("\n") # press enter to boot
55+ machine.wait_for_console_text("Linux version")
005657+ with subtest("Machine boots correctly"):
58+ machine.wait_for_unit("multi-user.target")
59+ '';
60+})
-3
nixos/tests/nixos-rebuild-install-bootloader.nix
···71 # at this point we've tested regression #262724, but haven't tested the bootloader itself
72 # TODO: figure out how to how to tell the test driver to start the bootloader instead of
73 # booting into the kernel directly.
74-75- with subtest("New boot entry has been added"):
76- machine.succeed("test -f /boot/loader/entries/nixos-generation-2.conf")
77 '';
78})
···71 # at this point we've tested regression #262724, but haven't tested the bootloader itself
72 # TODO: figure out how to how to tell the test driver to start the bootloader instead of
73 # booting into the kernel directly.
00074 '';
75})