Literary or formal equivalent of だけ. Used to limit something exclusively to the preceding noun or clause. Often seen in written language, formal speech, or set phrases.
Only members may enter.
The key to success is nothing but effort.
This ticket is valid only for today.
He can speak not only English but also French.
Right now, all I can do is make an effort.
だけ is the everyday, neutral word for 'only', while のみ is a more literary or formal equivalent used in written or set expressions.
ばかり often carries a nuance of excess or negative judgment about doing only one thing, whereas のみ is a neutral, formal limiter.
のみ is a more formal, written equivalent of しか/だけ meaning 'only', and unlike しか it does not require a negative predicate.
のみ is a formal or literary way to say 'only', whereas オンリー has a casual, pop-culture feel and is common in marketing copy.
飲み (from 飲む, 'to drink') is pronounced identically to the limiting suffix のみ but has a completely unrelated meaning of 'drinking'.
The exact derivation is uncertain, but のみ has been used as a restrictive particle since Old Japanese. It is not a contraction of another word and is considered a native Japanese particle.