Automation condition: "within x minutes before next sunset"

How would I write condition that is true “within x minutes before next sunset”?

automation:
  ...
  condition:
    # something involving '{{ states.sun.sun.attributes.next_setting  }}' I guess?
  ...

I think you. An just use the sunset event with a negative offset.