System won't boot path EFI stub

Looks like this is the only thread that shows up in Google about this issue, so I’ll post this here, perhaps it will help someone. I had the same issue on a Xiaomi Redmi Book Pro 14, I couldn’t get past “EFI stub: Measured initrd data into PCR 9” when booting from the NixOS live CD (nixos-minimal-24.11.712148.edf04b75c13c-x86_64-linux.iso). I tried updating BIOS as other people suggested, but it was already up to date. Arch and Ubuntu worked fine, however, so I figured it had something with the kernel. I tried older and newer versions of the kernel to no avail, then I started bisecting the diff between Ubuntu’s and NixOS’s kernel config, until I ended up with this:

{ config, pkgs, modulesPath, lib, ... }: {
  imports = [
    "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
#   "${modulesPath}/installer/cd-dvd/installation-cd-graphical-gnome.nix"
  ];

  boot.kernelPatches = lib.singleton {
    name = "config";
    patch = null;
    extraStructuredConfig = with lib.kernel; {
      ACPI_DEBUG = yes;
    };
  };
}

Adding CONFIG_ACPI_DEBUG fixed the issue, I managed to produce a working ISO with this command:

$ NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/release-24.11.tar.gz nix-shell -p nixos-generators --run "nixos-generate --format iso --configuration ./image.nix -o result"

IIUC, this option enables debug output for ACPI events, so I have no idea why it would be needed for boot, but it works.

I also had to add this boot.kernelPatches to my configuration.nix, otherwise the system wouldn’t boot after installation.