nixos/systemd-boot-builder: write each ESP path only once

Shared kernels and initrds appear once per generation in boot_files, so
InitrdWithSecretsWriter rebuilt the same file repeatedly. Prefer the
current configuration's entry so its failures stay fatal.
This commit is contained in:
r-vdp
2026-05-04 13:52:52 +02:00
parent 76673e2736
commit b4e756627d
@@ -614,7 +614,14 @@ def garbage_collect(gc_roots: BootFileList) -> None:
def write_boot_files(boot_files: BootFileList) -> None:
for boot_file in boot_files:
# Deduplicate by destination path so shared files are written once.
# Prefer the current configuration's entry so its failures are fatal.
unique: dict[Path, BootFile] = {}
for bf in boot_files:
if bf.path not in unique or bf.current:
unique[bf.path] = bf
for boot_file in unique.values():
boot_path = BOOT_MOUNT_POINT / boot_file.path
try:
boot_file.writer.write_boot_file(boot_path)