There is a point in a climbers life when progression or just curiosity will take you from the climbing gym on to a proper rock. It is very important that the gear you first buy is suitable for this transition. Buying your first rack can be absolute nightmare and therefore "must have" and "barely needed" will depend largely on where you gonna be climbing.
If you already have basic stuff as rock shoes, harness, rope, chalk bag and belay device here is a list of suggested items to complete a basic climbing rack. You will add more gear over the time to suit your climbing style.
Start with buying a passive protection. Solid nuts and hexes can be wedged in the rock and stay exactly where placed. These are light and fairly inexpensive.
Later you can add active protection such as cams which works by expanding and gripping the rock when loaded with weight.
Simple beginners rack:
Helmet: Get it! Beginner or not. No talking about this!
Slings: 120cm and 240cm are most useful when building belays and anchors. Dyneema slings are lighter and easier to knot then Nylon slings. Shorter 60cm and 120cm can be used for extending runners and reducing rope drag.
Quickdraws: A good first time buy as you can also use them when sport climbing. I prefer longer ones that helps to prevent lifting of protection. 8-12 quickdraws will be sufficient.
Screwgates carabiners: Used for building anchors, used with the belay devices and in multitude of other situations. Have 4-6 screwgates. Also buy at least 2 HMS carabiners as they can take 2 clove hitches without being crossloaded. When buying carabiners always note gate opening. Narrow opening can cause problems when clipping the rope.
Set of nuts: Size 1-11. For easier handling have them on two or three separate snapgates.
Nutkey: Great tool for those seconding and extracting passive protection from the rock.
Prussic Loop: Prussics are essential safety gear. Have 5-7mm wide 60cm long cord joined with Double Fisherman's knot. You will use prussic for ascending ropes or backup when abseiling.
Hexes: Hexes are bigger than nuts and sound like cowbells when clanging on the harness. Well placed hex in good rock is a solid peace of protection.
Cams: 2 or 3 camming devices size 1-3 should be enough for a start.