Motional entanglement with trapped ions and a nanomechanical resonator