diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py index bfae30eb3aa1..9f36dff3cc67 100644 --- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py +++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py @@ -258,6 +258,8 @@ def remove_old_entries(gens: list[SystemIdentifier]) -> None: bootspec = get_bootspec(gen.profile, gen.generation) known_paths.append(copy_from_file(bootspec.kernel, True).name) known_paths.append(copy_from_file(bootspec.initrd, True).name) + if bootspec.devicetree is not None: + known_paths.append(copy_from_file(bootspec.devicetree, True).name) for path in (BOOT_MOUNT_POINT / "loader/entries").glob("nixos*-generation-[1-9]*.conf", case_sensitive=False): if rex_profile.match(path.name): prof = rex_profile.sub(r"\1", path.name)