That can be done easily if you can compute the days between today and next sunday, something you said you already achieved, which can be done in several ways and I find to be the trickiest part.
Adding this to your custom agenda definitions (and re-evaluating it) will do it:
'(("s" "From today to next sunday"
;; ... other commands here
my/days-to-next-sunday should return the number of days between today and next Sunday you want to include in the agenda, I do assume that you want today included, so there is no need to look back 1 day in custom command definition.
s to call it from the agenda menu can be changed to anything you like.
As an aside example, taking the bare-bones, lazy (and not the better/proper) lane, given that
(format-time-string "%u") will return the current day of week, and those run from 0 (Sunday) to 6 (Saturday) this will return the number of days in between today and Sunday, today included. Please, spare any possible dumb bug, it's untested code just to show the idea.
(let ((dayspan 0)
(today (string-to-number (format-time-string "%u"))))
((> today 0)
; from today till sunday, today included
(setq dayspan (- 8 today)))
((= today 0)
; sunday to sunday
(setq dayspan 8)))))
Probably I'd rely on calc or system
date to find the dayspan if I were to write a more reusable way to find intervals, but it'll make the example harder to understand.