I've been told that the answer is all abelian groups, but I don't see how.
I know that the class of all nilpotent groups of degree 1 is a group variety and that a group being nilpotent of degree 1 is equivalent to that group being abelian so the class of all abeliani groups is indeed a variety. I also know that the integers are a group when considered with addition as the operation and that a class of algebraic structures of the same signature is a variety if and only if it is closed under the taking of homomorphic images, subalgebras and (direct) products, but I'm not quite sure how to use this here or if this is even the way to go about this.
I think that the main structure of this proof should be to show that $\mathbb{Z}$ is contained inside the variety of all abelian groups and then show that its the smallest one that could possibly contain $\mathbb{Z}$. I know that in the class of abelian groups, the language is $(+, 0, \frac{1}{})$ and the identities are $$(x+y)+z = x + (y+z),$$ $$x+y = y+x,$$ $$x + 0=x,$$ $$x+(-x) = 0,$$ all of which obviously hold on $\mathbb{Z}$. Is that enough to say that the class of abelian groups contains $\mathbb{Z}$?
How would I show nothing smaller could contain $\mathbb{Z}$?
I'll give an answer that does not depend on the HSP theorem.
Let $\mathsf{V}(\mathbb{Z})$ be the smallest variety containing the group $\mathbb{Z}$. Let $\mathcal{A}$ be the variety of all abelian groups. It should be clear that $\mathsf{V}(\mathbb{Z})\subseteq\mathcal{A}$ since $\mathbb{Z}$ is an abelian group. To show the other inclusion, we assume by way of contradiction that $\mathbb{Z}$ satisfies an equation that is not satisfied by all abelian groups. Let's call that equation $s\approx t$.
If $s\approx t$ is satisfied, then so is $s-t\approx 0$.
The equation $s-t\approx 0$ is of the form $m_1x_1+\dots+m_kx_k\approx 0$ for some integers $m_1,\dots,m_k$.
If $m_1x_1+\dots+m_kx_k\approx 0$ is satisfied, then so are the equations $m_1x\approx0$, $m_2x\approx0$, $\dots$, $m_kx\approx 0$.
If the equations $m_1x_1\approx0$, $\dots$, $m_kx\approx 0$ are satisfied, then so is $nx\approx0$ where $n=\gcd(m_1,\dots,m_k)$.
But $\mathbb{Z}$ does not satisfy $nx\approx0$ for any integer $n$; a contradiction!
The details still need to be filled in. If you can't figure them out yourself, then I recommend consulting Cliff Bergman's ''Universal algebra: fundamentals and selected topics.''