From ea8926534758117bcb4c0b2a2fff4d3f805ae0aa Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 7 Jul 2026 23:00:42 +0300 Subject: [PATCH] nixosTests.limine.additionalFiles: init This adds a test to check the file actually exists, and that changes update them, serving as a regression test for #537466. --- nixos/tests/limine/additional-files.nix | 51 +++++++++++++++++++++++++ nixos/tests/limine/default.nix | 1 + 2 files changed, 52 insertions(+) create mode 100644 nixos/tests/limine/additional-files.nix diff --git a/nixos/tests/limine/additional-files.nix b/nixos/tests/limine/additional-files.nix new file mode 100644 index 000000000000..9e7e00184185 --- /dev/null +++ b/nixos/tests/limine/additional-files.nix @@ -0,0 +1,51 @@ +{ pkgs, lib, ... }: +{ + name = "additionalFiles"; + meta.maintainers = with lib.maintainers; [ + flokli + ]; + meta.platforms = [ + "x86_64-linux" + ]; + nodes.machine = + { ... }: + { + virtualisation.useBootLoader = true; + virtualisation.useEFIBoot = true; + boot.loader.limine.enable = true; + boot.loader.limine.efiSupport = true; + boot.loader.timeout = 0; + + specialisation.withAdditionalFiles.configuration = { ... }: { + boot.loader.limine.additionalFiles = { + "efi/memtest86/memtest86.efi" = "${pkgs.memtest86-efi}/BOOTX64.efi"; + }; + }; + specialisation.withAdditionalFilesOther.configuration = { ... }: { + boot.loader.limine.additionalFiles = { + "efi/memtest86/memtest86.efi" = "${builtins.toFile "some-file" "some-content"}"; + }; + }; + }; + + testScript = + { nodes, ... }: + let + withAdditionalFiles = + nodes.machine.specialisation.withAdditionalFiles.configuration.system.build.toplevel; + withAdditionalFilesOther = + nodes.machine.specialisation.withAdditionalFilesOther.configuration.system.build.toplevel; + in + '' + machine.start() + machine.wait_for_unit("multi-user.target") + + # switch to a generation with additional files and ensure they're present + machine.succeed("${withAdditionalFiles}/bin/switch-to-configuration switch") + machine.succeed("stat /boot/efi/memtest86/memtest86.efi") + + # switch to the next generation with something else in there and ensure it got updated + machine.succeed("${withAdditionalFilesOther}/bin/switch-to-configuration switch") + assert machine.succeed("cat /boot/efi/memtest86/memtest86.efi").strip() == "some-content" + ''; +} diff --git a/nixos/tests/limine/default.nix b/nixos/tests/limine/default.nix index fd7a583f09c6..debce99b0fd8 100644 --- a/nixos/tests/limine/default.nix +++ b/nixos/tests/limine/default.nix @@ -3,6 +3,7 @@ ... }: { + additionalFiles = runTest ./additional-files.nix; bios = runTest ./bios.nix; checksum = runTest ./checksum.nix; secureBoot = runTest ./secure-boot.nix;