Self-buckling at the nanoscale