How to clean /boot partition?

I have asked this question before in Сan't change bootloader to grub, but the advice doesn’t help

Here is the error itself:

build system configuration...
GRUB 2 menu update...
unable to close file /boot/grub/grub.cfg.tmp: No space left on the device
Failed to install boot loader
warning: error(s) occurred while switching to a new configuration

Have you tried this already? Сan't change bootloader to grub - #3 by rhendric

Yes, but the error remains and when I write df -h the partition is 100% full

What’s the output of this command:

sudo nix-env --list-generations -p /nix/var/nix/profiles/system

I deleted everything else 40 2024-11-20 16:43:42 (current)

Huh. The systemd-boot-builder.py script should be cleaning up its own old files, but maybe you’ve already switched to GRUB and that script isn’t being run anymore. You may have to delete things manually this once, and then again if you switch back from GRUB to another bootloader. (I don’t use GRUB but I expect its builder script will also delete its own old files, just not systemd-boot’s.)

I just deleted everything from /boot