NixOS could not sync /boot after rebuild

could not sync /boot: Unknown error -1
Traceback (most recent call last):
  File /nix/store/9hgx4r755kdx1q55a52khk42j1mjd8hk-systemd-boot/bin/systemd-boot, line 452, in <module>
    main()
    ~~~~^^
  File /nix/store/9hgx4r755kdx1q55a52khk42j1mjd8hk-systemd-boot/bin/systemd-boot, line 435, in main
    install_bootloader(args)
    ~~~~~~~~~~~~~~~~~~^^^^^^
  File /nix/store/9hgx4r755kdx1q55a52khk42j1mjd8hk-systemd-boot/bin/systemd-boot, line 400, in install_bootloader
    raise e
  File /nix/store/9hgx4r755kdx1q55a52khk42j1mjd8hk-systemd-boot/bin/systemd-boot, line 389, in install_bootloader
    write_entry(*gen, machine_id, bootspec, current=is_default)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File /nix/store/9hgx4r755kdx1q55a52khk42j1mjd8hk-systemd-boot/bin/systemd-boot, line 227, in write_entry
    os.fsync(f.fileno())
    ~~~~~~~~^^^^^^^^^^^^
OSError: [Errno 5] Input/output error
Failed to install bootloader
Error: 
   0: Bootloader activation failed
   1: Adding configuration to bootloader (exit status Exited(1))

I looked into this issue but cleaning the garbage isn’t working either.

for me, a simple reboot and then nixos-rebuild boot fixed it. give it a try