Change:
Spent a fair bit debugging something. Came down to my DTB being out of sync. The lack of hash prefix should've warned me sooner. The issue is that the dtb is not copied with anything generation specific in the filename. The builder assumes the file is CA-addressed by parent store path, to avoid redundant copies. However, it also assumes it can make this path by taking basename of the specified file. This is file for initrd/kernel since they are second level in the derivation. However, this can't be assumed, and/or isn't true for the DTB. I would just send a PR but I can't think of a super easy/clean way to do this. The current approach (of assuming the depth of the file) is not great, IMO, but nicely avoids hashing the individual files, etc. Using a regex or chopping the prefix is not viable. The only idea I have -- use a regex to just capture the first instead of a b32 looking hash and hope that's good enough. I can do this depending on vibes. Steps to reproduce the behavior: two generation bug in older gen dtb from wherever it gets put (esp mount point or xbootldr), just to prove -install, which re-creates files for all generations, oldest first boot, notice old dtb, realize it lacks hash, realize this is fundamentally problematic. cc: A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. Add any other context about the problem here. <!-- Please @ people who are in the list of the offending package or module. If in doubt, check for whoever last touched something. --Please run and paste the result. Add a :+1: [reaction] to [issues you find important]. [reaction]: [issues you find important]:

Discussion:
GRACEFUL = "@graceful@" COPY_EXTRA_FILES = "@copyExtraFiles@" CHECK_MOUNTPOINTS = "@checkMountpoints@" <ins> STORE_DIR = "@storeDir@" </ins> @dataclass class BootSpec:

if not EDITOR: f.write("editor 0n") if REBOOT_FOR_BITLOCKER: <del> f.write("reboot-for-bitlocker yesn"); </del> <ins> f.write("reboot-for-bitlocker yesn") </ins> f.write(f"console-mode {CONSOLE_MODE}n") f.flush() os.fsync(f.fileno())

def copy_from_file(file: str, dry_run: bool = False) -> str: store_file_path = os.path.realpath(file) suffix = os.path.basename(store_file_path) <del> store_dir = os.path.basename(os.path.dirname(store_file_path)) efi_file_path = f"{NIXOS_DIR}/{store_dir}-{suffix}.efi" </del> <ins> store_subdir = os.path.relpath(store_file_path, start=STORE_DIR).split(os.path.sep)[0] efi_file_path = f"{NIXOS_DIR}/{suffix}.efi" if suffix == store_subdir else f"{NIXOS_DIR}/{store_subdir}-{suffix}.efi" </ins> if not dry_run: copy_if_not_exists(store_file_path, f"{BOOT_MOUNT_POINT}{efi_file_path}") return efi_file_path def write_entry(profile: str | None, generation: int, specialisation: str | None, machine_id: str, bootspec: BootSpec, current: bool) -> None: if specialisation:

isExecutable = true; <ins> inherit (builtins) storeDir; </ins> inherit (pkgs) python3; systemd = config.systemd.package;

) '' + pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isAarch64 '' machine.succeed( <del> "grep 'devicetree .*dummy' /boot/loader/entries/nixos-generation-1-specialisation-something.conf" </del> <ins> r"grep 'devicetree /EFI/nixos/[a-z0-9]{32}.*dummy' /boot/loader/entries/nixos-generation-1-specialisation-something.conf" </ins> ) ''; };