From 22ef2ba154e11aec324562a78b0a2656c6d39b72 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 7 Jul 2026 23:08:23 +0300 Subject: [PATCH 1/2] nixos/limine: fix location for boot.loader.limine.additionalFiles The documentation describes this as a set of files copied to /boot, with the attribute name denoting the destination file name in /boot. This uses essentially the same description as refind, systemd-boot and grub. However limine put it into limine_install_dir (/boot/limine by default) by accident, which broke downstream users. For example, nixos-apple-silicon uses boot.loader.limine.additionalFiles (and similar directives for other bootloaders) to update its m1n1 bootloader (which chainloads into u-boot, which chainloads into the bootloader selected in NixOS), and due to this bug, put new versions of it in the wrong location, effectively never updating m1n1. Fix this, by updating the location. The next commit adds a regression VM test for it. --- nixos/modules/system/boot/loader/limine/limine-install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/system/boot/loader/limine/limine-install.py b/nixos/modules/system/boot/loader/limine/limine-install.py index 0ddbd8a9f29b..9add26b636c6 100644 --- a/nixos/modules/system/boot/loader/limine/limine-install.py +++ b/nixos/modules/system/boot/loader/limine/limine-install.py @@ -621,7 +621,7 @@ def install_bootloader() -> None: paths[config_file_path] = True for dest_path, source_path in config("additionalFiles").items(): - dest_path = os.path.join(limine_install_dir, dest_path) + dest_path = os.path.join(str(config("efiMountPoint")), dest_path) copy_file(source_path, dest_path) From ea8926534758117bcb4c0b2a2fff4d3f805ae0aa Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 7 Jul 2026 23:00:42 +0300 Subject: [PATCH 2/2] 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;