TRIM not working on non-LVM LUKs encrypted external SSD. Need help!

I am currently running luks encrypted NixOS via external SSD and am facing issue with TRIM-ming it. For context, I have another un-encrypted SSD and I implemented similar config on it and TRIM works. I am not sure what I am doing wrong. Following is the structure of my SSD:
As you can see the sda2(swap) and sda3(root) are both able to support TRIM but their respective mapped luks are not able to (0B). Heres the UUID’s for the respective partitions and their luks:

Heres my configuration.nix and hardware-configuration.nix respectively. For both swap and root I have allowed discard:

You can try to set allow-discards in the LUKS2 header:


Thank you for your reply, this indeed solved the problem but this is quite a strange behavious becase I had already allowed discard on the the phyiscal sda2 drive so why do i still need to persist it on the mapped luks2. Also this feature is only available on Luks2, had to covert from Luks1 to Luks2. Also I have a laptop running nixos on the internal SSD with the same configs and allowing discard on the physical volume level sufficed and TRIM was working normally, didnt have to do these additional steps. Seems this behaviour is unique to external SSDs

I actually have a new problem now whereby I have another external SSD running nixos which is Luks-Lvm and im unable to go beyond persisting allow discard to the lvm root layer but am unable to enable TRIM for the sub volumes vg1-root (0B) and vg1-swap(0B), how may i proceed here. I tried to use a script to set issue_discards=1 for lvm.conf but no luck. Appreciate if you could help me in this instance as well. For better context this is the current structure of external SSD with LUKS-LVM: