A nearlattice is a join semilattice such that every principal filter is a lattice with respect to the induced order. Hickman and later Chajda et al independently showed that nearlattices can be treated as varieties of algebras with a ternary operation satisfying certain axioms. Our main result is that the variety of nearlattices is 2-based, and we exhibit an explicit system of two independent identities. We also show that the original axiom systems of Hickman as well as that of Chajda et al are dependent.